Slash Boxes
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.
More | Login | Reply
Loading... please wait.
  • The "blessed( $arg ) && $arg->isa('Some::Class')" idiom is not necessary. You can do

    #!perl -l
    $x = {};
    print UNIVERSAL::isa($x,"Foo::Bar") ? 1 : 0;
    print UNIVERSAL::isa($x,"HASH") ? 1 : 0;

    (as documented in the UNIVERSAL manpage)
    • I know, I was using it as a small, trite example. The actual problem is that its easier to refactor away conditions if everything is an object - which is my real dislike. I felt going into why I like to refactor away conditions was probably beyond the scope of the journal entry, which was more about having HASH/ARRAY/SCALAR/... objects, and the nice things that you can do once you have them.
      • And by the way are you going to upload magicrefs to some comprehensive perl archive network ?
        • It's essentially a patch against pp.c in the perl source. I could put it on CPAN, but it seems like a strange place to put a patch. I think it might be possible to do something similar with, but I need to talk to sky a little about that.