Lasher, Brian wrote:
> /I’ve got a script that looks like/
>
Please post in plain text.
> #!perl
>
>
>
> use LIB::DLOG;
>
>
>
> my $dlog = new DLOG('TYPEA','FILENAME');
>
>
>
> $dlog->read;
>
>
>
> exit;
>
>
>
>
>
> /I’ve got a package DLOG which looks like:/
>
>
>
>
>
> package DLOG.pm
>
>
>
> use LIB::DATALOG_PARSERS::TYPEA; # contains TYPEALOG package
>
> use LIB::DATALOG_PARSERS::TYPEB; # contains TYPEBLOG package
>
> use LIB::DATALOG_PARSERS::TYPEC; # contains TYPECLOG package
>
>
>
> sub new
>
> { my $class = shift;
>
> my $platform = shift;
>
> my $file = shift;
>
>
>
> if ($platform eq 'TYPEA') { @ISA = ("TYPEA"); }
>
> elsif ($platform eq 'TYPEB') { @ISA = ("TYPEB"); }
>
> elsif ($platform eq 'TYPEC') { @ISA = ("TYPEC"); }
>
>
>
> my $self = {};
>
>
>
> bless $self,$class;
>
>
>
> return $self;
>
> }
>
>
>
>
>
> /the read method that gets invoked is not present in the dlog module,
> but should be inherited from TYPEA.pm, etc. however perl is telling me
> that it can't find it. any idea why?/
Try something like:
use strict;
package LIB::DLOG;
use LIB::DATALOG_PARSERS::TYPEA;
use LIB::DATALOG_PARSERS::TYPEB;
use LIB::DATALOG_PARSERS::TYPEC;
our @ISA = qw(LIB::DATALOG_PARSERS::TYPEA LIB::DATALOG_PARSERS::TYPEB
LIB::DATALOG_PARSERS::TYPEC);
Or to export some methods/subs :
# use Exporter();
# our @ISA = qw(Exporter LIB::DATALOG_PARSERS::TYPEA
LIB::DATALOG_PARSERS::TYPEB LIB::DATALOG_PARSERS::TYPEC);
# our @EXPORT = qw(sub_a sub_b); # you can list exports in here
# our @EXPORT_OK = qw(local_a local_b); # and methods that need to be
called explicitly
# our %EXPORT_TAGS = (local => [EMAIL PROTECTED]); # or groups of methods
>
> script called from pwd.
>
> DLOG.pm in pwd/LIB/
>
> TYPEA.pm, etc in pwd/LIB/DATALOG_PARSERS/
>
>
>
> /Is there an issue with having the package name not equal to the module
> file name??/
The package name should always be the same (case sensitive) as the file
name (and path from INC member) without the .pm on the end.
DLOG.pm in ./LIB => package LIB::DLOG;
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs