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.
  • Since Perl doesn't even have "nil", wtf are you talking about?
    • Randal L. Schwartz
    • Stonehenge
    • I would assume creating an object that looks under casual inspection like [undef], but can support lots of methods, generally by returning itself. Which is to say an object that works like nil does in Ruby.

      This kind of object is surprisingly useful, but is impossible to create in Perl. You can almost get there, see Class::Null on CPAN. But not quite because override doesn't let you override defined.

      I'm guessing that jjore tried to resort to deeper hackery to get it, and discovered the hard way why override made that omission.

      • No, I already know I can replace the global PL_sv_undef with my own object, I can also override defined() everywhere in perl code. What I can't do is override all the XS which never calls defined() but rather more direct things like the C macro SvOK(sv).

        I would like to treat undef/nil as an instance of a NilClass but... impossible. Literally impossible.