CGI-FormBuilder
view release on metacpan or search on metacpan
lib/CGI/FormBuilder/Field.pm view on Meta::CPAN
219220221222223224225226227228229230231232233234235236237238sub
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
140141142143144145146147148149150151152153154155156157158159160}
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
117118119120121122123124125126127128129130131132133134135136
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
352353354355356357358359360361362363364365366367368369370371372
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 )