Flame has asked for the wisdom of the Perl Monks concerning the following question:
I have an interesting problem. I need to be able to require a list of modules... however even though I know that the file is there, it insists it is not.
This is the sub itself:
It is being called like this:
loadmod qw(RPG::Item::Weapon::Spear);
Any ideas about the problem?
This is the output:
I'm afraid I may not be very clear, but to summerize, I want to be able to import modules using require and a sub. If I wasn't clear enough on anything, just ask.
"Wierd things happen, get used to it"
Flame ~ Lead Programmer: GMS
http://gms.uoe.org
sub loadmod(@){ shift if(ref($_[0])); $@ = 0; foreach (@_){ croak("loadmod() cannot load any packages outside of it's own pa +ckage area (RPG). Package Requested: $pack") unless($_ =~ m/^RPG::/o +); eval{ require $_ }; croak("Unable to locate $_\n\@INC includes: ".join(", ", @INC)) +if($@); } }
It is being called like this:
loadmod qw(RPG::Item::Weapon::Spear);
Any ideas about the problem?
This is the output:
The file requested really exists... as: RPG/Item/Weapon/Spear.pmUnable to locate RPG::Item::Weapon::Spear @INC includes: E:/Perl/lib, +E:/Perl/site/lib, . at test1.pl line 5
I'm afraid I may not be very clear, but to summerize, I want to be able to import modules using require and a sub. If I wasn't clear enough on anything, just ask.
"Wierd things happen, get used to it"
Flame ~ Lead Programmer: GMS
http://gms.uoe.org
Edit: chipmunk 2001-10-16
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: require $package?
by andreychek (Parson) on Oct 17, 2001 at 04:24 UTC | |
by tilly (Archbishop) on Oct 17, 2001 at 05:01 UTC | |
Re: require $package?
by lestrrat (Deacon) on Oct 17, 2001 at 04:37 UTC | |
New Problem?
by Flame (Deacon) on Oct 17, 2001 at 06:06 UTC | |
by tilly (Archbishop) on Oct 17, 2001 at 06:31 UTC | |
by Flame (Deacon) on Oct 17, 2001 at 06:47 UTC | |
by tilly (Archbishop) on Oct 17, 2001 at 18:50 UTC | |
by Flame (Deacon) on Oct 17, 2001 at 23:45 UTC | |
Re: require $package?
by perrin (Chancellor) on Oct 17, 2001 at 04:40 UTC | |
Re: require $package?
by Flame (Deacon) on Oct 17, 2001 at 04:41 UTC |
Back to
Seekers of Perl Wisdom