Much nicer. One little issue, though:
# This: $cgi = CGI::self_or_default if $cgi and ! ref $cgi; # is not equivalent to this: $cgi = CGI::self_or_default if ! ref $cgi;
The reason this is the case is how it's called:
print $foo->list_params( 1 );
If someone supplies a false value, it should return "0". With the second version of your assignment to $cgi, it will always return the params, regardless of whether or not a false value has been passed. That might seem irrelevant, but this is a reduced test case of the actual code. Here's how this will be used in real life:
$write->table( -params => 1, -condition => "$x % 7 == 3", -active => 1, -caller => 0, SomeVar => $some_var, DATA => \%some_hash );
Since this is part of a debugging module, the programmer may want to turn off the param display once the params are verified, or turn them back on again if there is a problem. Rather than going through and deleting or re-entering the '-param' key, the programmer can just toggle the value at will. (I know we discussed this with /msgs, but this is for the benefit of those not privy to the conversation).
Cheers,
Ovid
Update: Hmm... I seem to be posting a lot of updates lately :(
Seems I missed a little if which drastically changes the meaning of tye's code:
if ( $cgi ) { $cgi = CGI::self_or_default if ! ref $cgi;
sigh
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In reply to (Ovid) Re: (tye)Re: (Ovid - Dang, I love this place :-)
by Ovid
in thread Typeglobs and Symbol tables
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |