robot_tourist has asked for the wisdom of the Perl Monks concerning the following question:
I have the following problem with object oriented Perl:
I have a package with a method connect
sub connect() { my $self = shift; my ($ip, $port) = @_; # more code }
When I call this method from another script via: $test->connect($ipaddr, $portno);
I get the following error:
Note: The error gives the value of $ipaddr and $portno, but I don't want you to hak me :)Wrong number of parameters: expected 0, got 3. Foo::connect('Foo=HASH(0xca3df0)', $ipaddr, $portno) called at test_co +nnect.pl line 10
I have looked at every doc I can think of and even using sub connect(\$$$) {} doesn't help. Where am I going wrong? My new constructor works perfectly.
I have a wiry brain/each eye a camera. Robot Tourist, by Ten Benson
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Wrong number of arguments in methods call
by davis (Vicar) on May 09, 2002 at 10:57 UTC | |
by robot_tourist (Hermit) on May 09, 2002 at 11:33 UTC | |
by tachyon (Chancellor) on May 09, 2002 at 12:08 UTC | |
by robot_tourist (Hermit) on May 09, 2002 at 13:44 UTC |