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

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday April 03, 2009
07:14 AM

Surprising Deparse Result

[ #38742 ]

Tracked down a weird bug in our code. This could make for interesting obfuscations.

$ perl -MO=Deparse -e 'f("x");sub f {expand { datatype => shift }}'
sub f {
    do {
        'datatype', shift @_
-e syntax OK

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.
  • WTF is expand?

    % perldoc -f expand
    No documentation for perl function `expand' found


    • The weird code just through you off there. It's a key in a hash. If there was a fat comma (=>) to the right of "expand", that code would look and behave just fine.

      • Ah, I see. Except that it's not a key in a hash in that code, but a method.


        • A: I should have written "threw", not "through". I hate it when I do that. B: I know it's a method. That was the point of the original post :)

  • Not all that surprised, I assume that works the same way as:

    my $dog = new Dog;

    does. More not-much-used-syntax we should get rid of?

    (Hmm, print uses it, took me a while to figure which doc it's in, perlobj)

    Aren't typos fun?