NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
undef vs. '' (Score:1)
i usually find clarity using undef vs ''. for instance, i'd write
$pg->owns( undef, 'gold' );instead of
$pg->owns( '', 'gold' );then again, if i wanted a more 'prologgy' syntax, i think i'd create a constant with an undefined value, like
sub X () {}## or use constant X => undef;
$pg->owns( X, 'gold' );
in fact, i think i like the Prolog-like syntax in my last example. that's probably what i'll find myself using.
hrmmm... what if X is an lvalue subroutine?
Reply to This
Re:undef vs. '' (Score:2)
I think you'll be relatively happy with this. In the auto-generated rules, if an argument is encountered with a false value, such as the empty string or undef, it's ignored (sort of). This means that if you prefer undef, you'll be perfectly free to use it.
As for $pg->owns( X, 'gold' );, I like the syntax, but forcing a person to predefine all of those constants means that it will be harder for them to generate queries on the fly.
use constant Who => '';