Stories
Slash Boxes
Comments
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • by particle (3326) on 2002.07.25 8:47 (#11049) Journal

    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?

    • 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 => '';