from 'perldoc -f use'
================================================ use Module (); That is exactly equivalent to BEGIN { require Module } ================================================ me thinks, what you want is > #!/usr/bin/perl > BEGIN > { > $mod = "CGI"; > unless (eval "require $mod") > { > warn "unable to install $mod $@\n"; > } > } > On Tue, 2003-01-21 at 14:36, Victor Tsang wrote: > I have a piece of code which will be used in two different environment, > One of the difference of the 2 system is a special library that is > avaiable to only one of them. Going into the cookbook I found example > 12.2 very suitable for my need. So I created the following code to test > the idea > > #!/usr/bin/perl > BEGIN > { > $mod = "CGI"; > unless (eval "use $mod") > { > warn "unable to install $mod $@\n"; > } > } > > > I expected this to work ok, but to my surprise, when I execute it, I get > this : > > [htsang@victor htsang]$ ./test.perl > unable to install CGI > > > To verify CGI.pm is there, I did the following in the same machine. > > [htsang@victor htsang]$ perl -MCGI -e "print \$CGI::VERSION" > 2.56[htsang@victor htsang]$ > > > > Anyone has any idea what I did wrong? > > Many thanks. > > > Tor. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]