o_chfa has asked for the wisdom of the Perl Monks concerning the following question:
I have a serverlist in a module called serverNames.pm and a script using it. serverNames.pmmodule is homed in ~/lib and the script is homed in ~/bin. So I used following snippet to retieve my data
# !/opt/OV/bin/Perl/bin/perl -w use FindBin; use lib $FindBin::Bin; # path 2 scripts use lib "$FindBin::Bin/../lib"; # path 2 modules use lib serverNames; # contains ARRAY serverList print @serverList; # very simple, I know ;-)
Before runnig I get following:
$ perl -w pfadTest.pl Name "main::serverList" used only once: possible typo at pfadTest.pl line 7
My snippet with strict
# !/opt/OV/bin/Perl/bin/perl -w use strict; use FindBin; use lib $FindBin::Bin; # path 2 scripts use lib "$FindBin::Bin/../lib"; # path 2 modules use lib serverNames; # contains ARRAY serverList print @serverList; # very simple, I know ;-)
produces:
Bareword "serverNames" not allowed while "strict subs" in use at pfadTest.pl line 6. Global symbol "@serverList" requires explicit package name at pfadTest.pl line 8. Execution of pfadTest.pl aborted due to compilation errors.
The module name in ~/lib is serverNames.pm and my OS is HP-UX **** B.11.11 U 9000/800
update: The script is 755 (-rwxr-xr-x). A call with perl -w ~/bin/pfadTest.pl doesn't help either.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: FindBin doens't work
by moritz (Cardinal) on Sep 02, 2009 at 11:18 UTC | |
|
Re: FindBin doens't work
by Sewi (Friar) on Sep 02, 2009 at 12:48 UTC |