Changeset 32 in text-formbuilder


Ignore:
Timestamp:
11/17/04 14:57:58 (19 years ago)
Author:
peter
Message:

fall through to CGI::FormBuilder builtin option lists if @LIST does not match a list directive

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r30 r32  
    1212    * added a !section directive that splits up a form into 
    1313      sub-tables with their own ids and captions 
     14    * fall through to CGI::FormBuilder builtin option lists 
     15      if @LIST does not match a list directive 
    1416     
    15170.05 -  9 Nov 2004 
  • trunk/lib/Text/FormBuilder.pm

    r31 r32  
    5757     
    5858    local $/ = undef; 
    59     open SRC, "< $filename"; 
     59    open SRC, "< $filename" or croak "[Text::FormBuilder::parse_file] Can't open $filename: $!" and return; 
    6060    my $src = <SRC>; 
    6161    close SRC; 
     
    6969    # so it can be called as a class method 
    7070    $self = $self->new unless ref $self; 
     71     
     72    # append a newline so that it can be called on a single field easily 
     73    $src .= "\n"; 
    7174     
    7275    $self->{form_spec} = $self->{parser}->form_spec($src); 
     
    105108    # expand groups 
    106109    my %groups = %{ $self->{form_spec}{groups} || {} }; 
    107      
    108110    for my $section (@{ $self->{form_spec}{sections} || [] }) { 
    109 ##         foreach (grep { $$_[0] eq 'group' } @{ $self->{form_spec}{lines} || [] }) { 
    110111        foreach (grep { $$_[0] eq 'group' } @{ $$section{lines} }) { 
    111112            $$_[1]{group} =~ s/^\%//;       # strip leading % from group var name 
     
    149150            $$_{options} = \@list; 
    150151        } else { 
    151 ##             #TODO: this is not working in CGI::FormBuilder 
    152 ##             # assume that the list name is a builtin  
    153 ##             # and let it fall through to CGI::FormBuilder 
    154 ##             $$_{options} = $$_{list}; 
    155 ##             warn "falling through to builtin $$_{options}"; 
     152            # assume that the list name is a builtin  
     153            # and let it fall through to CGI::FormBuilder 
     154            $$_{options} = $$_{list}; 
    156155        } 
    157156    } continue { 
     
    168167    # TODO: configurable threshold for this 
    169168    foreach (@{ $self->{form_spec}{fields} }) { 
    170         $$_{ulist} = 1 if defined $$_{options} and @{ $$_{options} } >= 3; 
     169        $$_{ulist} = 1 if ref $$_{options} and @{ $$_{options} } >= 3; 
    171170    } 
    172171     
     
    230229    my ($self, $package, $use_tidy) = @_; 
    231230 
    232     croak 'Expecting a package name' unless $package; 
     231    croak '[Text::FormBuilder::write_module] Expecting a package name' unless $package; 
    233232     
    234233    # automatically call build if needed to 
Note: See TracChangeset for help on using the changeset viewer.