[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
[MacPerl-Modules] Glue parameters
Hm, I just thought of something. Why do I do this?
$g->event($directobject, {param1 => 1, param2 => 2});
Instead, I think, couldn't I do this?
$g->event($directobject, param1 => 1, param2 => 2);
The only reason I can remember why I did it the former way was so that I
could say "if $_[1] is not a hashref, then it is the direct object".
But I could do the same thing by just checking @_ % 2 to see if the number
of parameters is odd or even. If it is (after removing the first
parameter, the object) odd, then the direct object is the first param. If
not, then there is no direct object (unless passed with the special _dobj
parameter name).
I am just throwing this out in case anyone remembers why I didn't think of
this before. :)
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-modules-request@macperl.org