Hi Folks,
I have an object called Cisco:cs2600. I have a constructor that will new
that will initialise all the object with all the relavant information.
Now, I call the constructor to create a new instance of this object.
$deviceType = Cisco::cs2600->new($systemObjectID);
So, now I have an object of a Cisco 2600. But that is not what I am
looking to manipulate. That mearly tells me what I can do with this type
of device. What I would like is to create an instance of a Cisco 2600
type.....
The specific instance will have an IP address, Community string, etc.
associated with it.
So,
$device = Device->new($IPAddress, $CommunityString).
QUESTION1: I have declared Cisco::cs2600 class, can I just declare a
class called Device, or should it be Cisco::Device?
Now I know this is inheritance, and I know I should just include an ISA
in the top of the Device package like so:
package Device;
use strict;
@Device::ISA = qw( Cisco::cs2600 );
sub new {
$self = $_[0];
bless { _ipaddress = $_[1],
_community = $_[2]
};
}
QUESTION2: If I would like to initialise the DeviceType when should it
be done?
So for example, I have 10 devices all with different IPAddresses and
Community strings, but all Cisco 2600's, should I do this:
$deviceType = Cisco::cs2600->new($systemObjectID);
foreach $IPAddress ( keys %{$All_Network_Switches} ) {
$kit = Device->new($IPAddress, $All_Network_Switches{$IPAddress});
.....do something with this kit, then get the next one.....
}
Finally, in the '....do something with this kit,.....', I would like to
get certain attributes for the deviceType, could I do something like
Device->get_DeviceType_information();
and this would call the method from Cisco::cs2600.
Thanks in advance for reading to here. As a special addition to the
persistent reader, I give you this special gift....a 1 year subscription
to all my received spam ;-). Only kidding.
Thanks.
Hamish
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]