Changeset 32 in text-formbuilder for trunk/lib/Text
- Timestamp:
- 11/17/04 14:57:58 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder.pm
r31 r32 57 57 58 58 local $/ = undef; 59 open SRC, "< $filename" ;59 open SRC, "< $filename" or croak "[Text::FormBuilder::parse_file] Can't open $filename: $!" and return; 60 60 my $src = <SRC>; 61 61 close SRC; … … 69 69 # so it can be called as a class method 70 70 $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"; 71 74 72 75 $self->{form_spec} = $self->{parser}->form_spec($src); … … 105 108 # expand groups 106 109 my %groups = %{ $self->{form_spec}{groups} || {} }; 107 108 110 for my $section (@{ $self->{form_spec}{sections} || [] }) { 109 ## foreach (grep { $$_[0] eq 'group' } @{ $self->{form_spec}{lines} || [] }) {110 111 foreach (grep { $$_[0] eq 'group' } @{ $$section{lines} }) { 111 112 $$_[1]{group} =~ s/^\%//; # strip leading % from group var name … … 149 150 $$_{options} = \@list; 150 151 } 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}; 156 155 } 157 156 } continue { … … 168 167 # TODO: configurable threshold for this 169 168 foreach (@{ $self->{form_spec}{fields} }) { 170 $$_{ulist} = 1 if defined$$_{options} and @{ $$_{options} } >= 3;169 $$_{ulist} = 1 if ref $$_{options} and @{ $$_{options} } >= 3; 171 170 } 172 171 … … 230 229 my ($self, $package, $use_tidy) = @_; 231 230 232 croak ' Expecting a package name' unless $package;231 croak '[Text::FormBuilder::write_module] Expecting a package name' unless $package; 233 232 234 233 # automatically call build if needed to
Note: See TracChangeset
for help on using the changeset viewer.