On Jul 15, chad kellerman said:
>I am trying to include my own perl module that is outside the regular
>@INC array. But my perl script still can not find it.. Any suggestions
>would be appreciated...
>script.pm
>
>package Script;
>BEGIN {
> use Exporter;
> @ISA = qw( Exporter );
> @EXPORT = qw($serverList);
>}
Why the BEGIN block? Where'd you pick that up from?
>
># declaring variable for main server list
>my $serverList = "/home/user/somefile";
>return 1;
>END { }
You say here that your file is "script.pm". But later, you try to load
Script.pm (because 'use Script' looks for Script.pm). I suggest you
rename script.pm to Script.pm. Modules should have the same name as their
package (so Foo::Bar should be Foo/Bar.pm).
Also, I have bad news for you. You cannot export a my() variable. All
exported variables must by package-variables, not lexicals. (No one has
mentioned this yet, and this is a far greater problem.)
>script.pl
>
>use strict;
>$|++;
>
>push (@INC, '.');
Insufficient. 'use' happens BEFORE everything else in your program, so
this is too late. Replace it with
use lib ".";
>use FileHandle;
>use Script;
>
>use vars qw(
> $msl %msl
>);
>
>print $serverList;
That will not print anything until you remove the 'my' from the
declaration of $serverList in Script.pm.
> But is fails with the typical Can't locate Script.pm in @INC (@INC contains:
>etc.
What on earth posessed you to TRUNCATE an error message? That is terribly
unhelpful.
>I am on linux running this from /home/server/scripts/
Linux is case-sensitive, so 'use Script' cannot find 'script.pm'.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]