> > Any ideas what I'm missing ??
>
> Hi Dan,
Howdy
>
> It sounds like you have a concept of the purpose of
> inheritance, but some of it backward, and some of that magic
A lto of it backwards! ;p
> is irrelevant to Perl, since Perl lacks types. The ISA
> relationship means that you can store objects of various
> subtypes in a cntainer declared for their supertype, for
> instance. Doesn't matter much in Perl, since containers can
> hold scalars of any type anyway.
>
> The other advantage of inheritance, and a very relevant one,
> is the ability to access *methods of base types* through
> anobject declared as a subtype. The important point is that
> ISA [pronounced always "izza'"] izza one-way relationship in
> most cases. Anytime you slip behind the wheel of a
> Lamborghini, you are getting into an automobile. Don't you
> just wish the converse were true? No, you can't buy a Pinto
> and do 165 mph down Main St. That method simply isn't
> available in an object of the generic Automobile class.
>
> Joseph
Ok if I explain it clearer than I have, I have a tendancy to
ramble, maybe that will help:
My Module is Nat.pm :
package Net::Telnet::Cisco::Nat;
Most of the functions in here use a Net::Telnet::Cisco Object
that is logged in already to call Net::Telnet:Cisco 's methods,
like enable() for instance.
#!/usr/bin/perl -w
use strict;
use Net::Telnet::Cisco;
use Net::Telnet::Cisco::Nat;
#### start conf ##
my $hst = '1.1.1.1';
my $usr = '';
my $pss = 'passwd';
my $enablepasswd = $pss;
#### end config ##
my $ses = Net::Telnet::Cisco->new(Host => $hst);
if($ses) {
if($ses->login($usr,$pss)) {
# here I want to use Net::Telnet::Cisco::Nat functions that can use
$ses internally
# this is where I'm really messing up, I can creat a new Object for it
or call the functions directly but in #both cases I have to pass $ses eithe
to the objetc ceration ot the funtion call:
for(Net::Telnet::Cisco::Nat->ListNat($ses, {EnableInfo =>
[$enablepasswd]})) { print; }
# or
my $nat = new Net::Telnet::Cisco::Nat($ses);
for($nat->ListNat({EnableInfo => [$enablepasswd]})) { print; }
# they both work but I know I'm missing some major points of
inheritance
# do some more stuff with $ses and Net::Telnet:Cisco functions here
} else { print "Can not login: ";print $ses->errmsg; }
$ses->close;
} else { print "Could not create initial session object to -$hst-\n"; }
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]