Sep 6, 2000, 2:56 PM
Post #2 of 2
I'll answer as much as I can here. I don't have time to write a full article on it, since I have other things in the works.
First, as far as exporting functions and variables, have a GOOD READ through the Exporter.pm docs. They explain how to use the Exporter module, and the @EXPORT, @EXPORT_OK, and %EXPORT_TAGS variables.
Inheritance is far easier in Perl than, say, C++. None of this private/protected/public nonsense:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>
sub new; # you do have to actually DEFINE these functions...
@ISA = qw( BaseClass );
$a = SubClass->new;
# SubClass does not provide a 'that' method
# but SubClass inherits from BaseClass, which
# does have a 'that' method
# the equivalent call is similar to
A class can inherit from many other classes. The order of base-class searching is depth-first. That is, first check $ISA's methods. If not there, if that class has an @ISA tree, go through THAT, and so on. If no match is found, go to $ISA.
Hmm. That's all for now. You might see an article from me in a couple of months.
Jeff "japhy" Pinyan -- accomplished author, consultant, hacker, and teacher