lightbringer has asked for the wisdom of the Perl Monks concerning the following question:
I have created a class and tried to create an object with that class, but I keep having this error
Can't locate object method "new" via package "Switch" at test.pl line 5.
Here's the code:
class Code:program codeuse Net::Telnet(); package Switch; sub new { my $class = shift; my $location = shift; my $ip = shift; my $self = {}; bless $self, $class; return $self; } 1;
does anyone know how to fix this error? Thanks in advanceuse Switch; use strict; use warnings; my $switch = Switch -> new();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Error with creating new objects
by GrandFather (Saint) on Jun 25, 2012 at 03:25 UTC | |
by Anonymous Monk on Jun 25, 2012 at 07:08 UTC | |
Re: Error with creating new objects
by NetWallah (Canon) on Jun 25, 2012 at 03:21 UTC | |
Re: Error with creating new objects
by mrguy123 (Hermit) on Jun 25, 2012 at 07:13 UTC |