in reply to Passing undefined values to package
Since checked is only checking for a scalar, the simplest solution would be this:
Without the scalar, the call to param happens in list context, so it returns the empty list, (), which gets lost. By forcing a scalar context then param returns undef.Validate->checked( scalar $query->param( 'method' ), 1 );
% perl -de 1 Loading DB routines from perl5db.pl version 1.23 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 1 DB<1> use CGI 'param' DB<2> @x = param( 'foo' ) DB<3> @y = scalar param( 'foo' ) DB<4> x @x empty array DB<5> x @y 0 undef DB<6> p scalar @x 0 DB<7> p scalar @y 1
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing undefined values to package
by bradcathey (Prior) on Aug 04, 2005 at 13:43 UTC |