![]() |
OOP Perl
I am new to using OO Perl and am having some difficulties gettting started. Basically, I have defined a class called Connection that defines a Connection object. A Connection is a tcp connection, so an instance of the class stores a source IP, source port, destination IP, etc. I have tested the class and as far as I can tell, it is working correctly. However, I want to create an array of Connections to keep track of all the connections in an tcpdump trace file. Perl doesn't complain when I create a new Connection and push it onto an empty array called @connections. However, when I try to reference that object I get an error. Here is some of the relevant code:
:
my @connections = {};Like I said, there are no compilation errors, and there are no errors in creating the $new_connection object or pushing it onto the empty array. The run-time error I am getting comes from the line: if ($connections[$index]->sourceIP() eq $sIP ) The error I am getting is : Can't call method "sourceIP" on unblessed reference at line 69 However, the object is blessed. I have tested just declaring a single object and that seems to be working. It is only when I try to refer to it in an array that I get the problem. I am not sure if I can even declare an array of a user-defined class. Is this possible, and if not how can I go about storing large amounts of instances of my class? Thanks, skm376 |
Re: OOP Perl
I noticed that its been awhile since you posted this....did you ever get your problem resolved?
|
| All times are GMT -5. The time now is 9:53 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC