@ISA and the paths in 'use libs'
- From: "Nik J" <perlmedian@xxxxxxxxx>
- Date: 25 May 2005 09:13:01 -0700
I'm an avid OO perl programmer but it is only recently that I have had
to create modules that would use inheritence. My modules are in a
private area outside of the usual @INC directories so I use the 'use
lib' to point paths to my modules.
The problem I have is that now that I want to use @ISA to inherit a
modules methods, but it doesn't seem to look for it in the 'use lib'
paths I give.
Here are the details:
So in my /home/nj/perl_libs/ I have BaseNJ.pm
In /home/nj/perl_libs/BaseNJ I have a Tools.pm
/home/nj/perl_libs/BaseNJ.pm
---------------------------
#!/usr/bin/perl
package BaseNJ;
use strict;
use warnings;
use lib qw( /home/nj/perl_libs );
our @ISA = qw( BaseNJ::Tools );
[CODE SNIP]
/home/nj/perl_libs/BaseNJ/Tools.pm
---------------------------------
#!/usr/bin/perl
package BaseNJ::Tools;
use strict;
use warnings;
use lib qw( /home/nj/perl_libs );
sub sub_method {
[CODE SNIP]
}
[CODE SNIP]
test.pm
-------
#!/usr/bin/perl
use strict;
use warnings;
use lib qw( /home/nj/perl_libs );
use BaseNJ;
my $obj = new BaseNJ();
$obj->sub_method(); # dies here
OUTPUT
------
Can't locate package BaseNJ::Tools for @BaseNJ::ISA at /home/nj/test.pl
line 9.
Can't locate package BaseNJ::Tools for @BaseNJ::ISA at /home/nj/test.pl
line 13.
Can't locate package BaseNJ::Tools for @BaseNJ::ISA at /home/nj/test.pl
line 13.
Can't locate object method "sub_method" via package "BaseNJ" at
/home/nj/test.pl line 13.
Can someone suggest to me how I could make this work? Or am I doing
something completely wrong? I basically want to split up the methods of
this class into separate files for easier maintenance and read ability.
Thank you all,
Nik J
.
- Follow-Ups:
- Re: @ISA and the paths in 'use libs'
- From: Nik J
- Re: @ISA and the paths in 'use libs'
- Prev by Date: Re: while loop -> map
- Next by Date: Re: while loop -> map
- Previous by thread: perl 'advancing' variable facility..
- Next by thread: Re: @ISA and the paths in 'use libs'
- Index(es):