PAR and BEGINs

Juan José 'Peco' San Martín <[email protected]>
Newsgroups gmane.comp.lang.perl.par
Message-ID <CAPGFf2Es6p-sf2+vZMz8Ks6Zt1KOYUWn7yb8z1XU2RU28Pa9Ng@mail.gmail.com>
Hello all!

I have a strange behaviour, any idea or help is welcome.

I've developed a program in Linux that by dependencies needs
/usr/lib/perl5/Net/DNS/Resolver.pm

The last release of Resolver.pm starts with a BEGIN block like follows:









*use vars qw(@ISA);BEGIN {        for ( $^O, 'UNIX' ) {               my
$class = join '::', __PACKAGE__, $_;               return @ISA = ($class)
if eval "require $class;";       }       die 'failed to load platform
specific resolver component';}*
The program works, so I created the executable to make an easier
deployment...
but I am surprised to see that it fails with the message: *failed to load
platform specific resolver component*

The workaround is replace the BEGIN by something platform dependent:

require Net::DNS::Resolver::UNIX;
@ISA = qw(Net::DNS::Resolver::UNIX);

Any idea?

Cheers,
Peco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.