CGI-FormBuilder

 view release on metacpan or  search on metacpan

lib/CGI/FormBuilder/Field.pm  view on Meta::CPAN

219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
sub inflate_value {
    my ($self, $v_aref) = @_;
 
    debug 2, "$self->{name}: called \$field->inflate_value";
 
    # trying to inflate?
    return unless exists $self->{inflate};
    debug 2, "$self->{name}: inflate routine exists";
 
    # must return real values to the validate() routine:
    return if grep { ((caller($_))[3] eq 'CGI::FormBuilder::Field::validate') }
                1..2;
    debug 2, "$self->{name}: made sure inflate not called via validate";
 
    # must be valid:
    #return unless exists $self->{invalid} && ! $self->{invalid};
    return if $self->invalid;
    debug 2, "$self->{name}: valid field, inflate proceeding";
 
    my $cache = $self->{inflated_values};

lib/CGI/FormBuilder/Source/File.pm  view on Meta::CPAN

140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
} elsif ($line =~ s/^\\(.)//) {
    # Reference - this is tricky. Go all the way up to
    # the top to make sure, or use $self->{caller} if
    # we were given a place to go.
    my $r = $1;
    my $l = 0;
    my @p;
    if ($self->{caller}) {
        @p = $self->{caller};
    } else {
        while (my $pkg = caller($l++)) {
            push @p, $pkg;
        }
    }
    $line = "$r$p[-1]\::$line" unless $line =~ /::/;
    debug 2, qq{eval "\@val = (\\$line)"};
    eval "\@val = (\\$line)";
    belch "Loading $line failed: $@" if $@;
} else {
    # split commas
    @val = split /\s*,\s*/, $line;

lib/CGI/FormBuilder/Util.pm  view on Meta::CPAN

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
    debug 1, "this is printed";
    debug 2, "but not this one";
 
A newline is automatically included, so don't provide one of your own.
 
=cut
 
sub debug ($;@) {
    return unless $DEBUG >= $_[0];  # first arg is debug level
    my $l = shift;  # using $_[0] directly above is just a little faster...
    my($func) = (caller(1))[3];
    #$func =~ s/(.*)::/$1->/;
    warn "[$func] (debug$l) ", @_, "\n";
}
 
=head2 belch($string)
 
A modified C<warn> that prints out a better message with a newline added.
 
=cut

lib/CGI/FormBuilder/Util.pm  view on Meta::CPAN

352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
        my %opt  = arghash(@_);
    }
 
It will return a hashref in scalar context.
 
=cut
 
sub arghash (;@) {
    return $_[0] if ref $_[0] && ! wantarray;
 
    belch "Odd number of arguments passed into ", (caller(1))[3]
       if @_ && @_ % 2 != 0;
 
    return wantarray ? @_ : { @_ };   # assume scalar hashref
}
 
=head2 arglist(@_)
 
This returns a list of args passed into a sub:
 
    sub value {



( run in 0.273 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )