grrrrr.....

nkuipers nkuipers at uvic.ca
Mon Oct 21 19:09:28 CDT 2002


Could someone please explain to me the how-to of grouping modules in a 
namespace.  Here's the situation.

I have two modules written, one called Blaster.pm and one called Basic.pm.  
They were originally placed in the same folder as a driver script for 
Basic.pm.  The driver contained the lines

BEGIN { push @INC, '/home/nkuipers/code';
use Basic;
my $dnaobj = Basic->new();

And worked beautifully.

Then I put both modules in a different folder, BIO.

I've diddled with the begin block to reflect the new path, ie., 
/home/nkuipers/code, home/nkuipers/code/, .../BIO, .../BIO/, etc.  I've 
diddled with the use statment, ie., use Basic, use BIO::Basic, use ... ().  
I've diddled with the constructor call, ie., ...BIO::Basic->new(), 
Basic->new().  Nothing works.  Depending on the combination of diddling, it 
dies with a "Cannot locate package BIO::Basic, @INC contains...BEGIN failed at 
compile time", or "Can't locate object method "new" via package "BIO::basic" 
or even "Undefined subroutine at &main::get_count called at driver line 14."  
I realize this is not informative since it doesn't match error to combination, 
but who cares what I'm doing wrong, how is it done right.  What's the missing 
idiom here?

TIA,

Nathanael




More information about the Victoria-pm mailing list