in reply to Re^2: BEGIN and compile-time
in thread BEGIN and compile-time
It's kludgy and noisy but it works.$ cat a/strict.pm package strict; our $VERSION = 1.04; sub VERSION { my ($module, $version) = @_; return $VERSION unless $version; until ($VERSION == $version) { shift @INC; delete $INC{"strict.pm"}; eval " require strict; 1; "; $VERSION = $strict::VERSION; } return $VERSION; } $ cat ./strict #!/usr/bin/perl -Wl BEGIN { eval { local @INC = @INC; unshift @INC, qw|a b c|; eval " use strict 1.03 qw|subs vars refs|; 1; "; warn "$@" if $@; }; } print "strict using $INC{'strict.pm'} version $strict::VERSION "; $ ./strict strict using /usr/share/perl/5.8/strict.pm version 1.03
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: BEGIN and compile-time
by ikegami (Patriarch) on Nov 11, 2006 at 10:43 UTC | |
|
Re^4: BEGIN and compile-time
by Firefly258 (Beadle) on Nov 11, 2006 at 18:49 UTC |