in reply to Re^2: ifdef in modules
in thread ifdef in modules

I think that by the time lib modifies @INC, ifdef has already done its thing. One possible workaround would go something like:

$ PERL5LIB=perl5lib:$PERL5LIB perl -Mifdef=DEBUGGING foo.pl

the lowliest monk

Replies are listed 'Best First'.
Re^4: ifdef in modules
by clee (Novice) on Jun 14, 2005 at 19:50 UTC
    Hmm...that still doesn't work for me. I'm on a Win32 system though, so I tried:
    set PERL5LIB=perl5lib;%PERL5LIB% perl -Mifdef=DEBUGGING foo.pl
    I also tried changing foo.pl like so:
    # ./foo.pl: use lib './perl5lib'; use ifdef qw/DEBUGGING/; use Bar; =begin DEBUGGING die "limbo"; =cut die "outer death"; __END__

    Here, the 'use lib' clearly comes before 'use ifdef', but still no luck.

    I should also note that, unexpectedly, this doesn't output 'limbo' either (when run as 'perl foo.pl'). However, that is another issue that is, I believe, unrelated to 'use lib'. In the thread I originally referenced, it indicates that "this pragma is only intended to be called from the commandline" anyway.