Sub-refs in @INC screwing with your modules

David Cantrell david at cantrell.org.uk
Wed Aug 5 20:48:53 BST 2009


As part of an Evil Plan, I am putting a sub-ref into @INC that will
screw around with modules as they're loaded.  Or at least, I'm trying
to.  I can't seem to get this to work:

perl -MIO::Scalar -e '
    unshift @INC, sub {
        print q{wibble};
        return IO::Scalar->new(\q{print q{wobble}})
    };
    eval "use foo"
'

which *should*, if I've RTFM correctly, print "wibblewobble".  But the
wobble never appears.  What am I doing wrong?

-- 
David Cantrell | Hero of the Information Age

  Sobol's Law of Telecom Utilities:
    Telcos are malicious; cablecos are simply clueless.


More information about the london.pm mailing list