in reply to Wrong number of arguments in methods call

It's because you've supplied connect with a prototype by appending the parentheses - () to the name
Remove these, and it should work.
see perldoc perlsub for more information.
hope that helps
davis
Is this going out live?
No, Homer, very few cartoons are broadcast live - it's a terrible strain on the animator's wrist

Replies are listed 'Best First'.
Re: Re: Wrong number of arguments in methods call
by robot_tourist (Hermit) on May 09, 2002 at 11:33 UTC

    Removing the () from connect still gives me the same error. Also, calling connect with no arguments (well just the implied object) gives me the same error: 3 arguments received when 0 expected (although $ipaddr and $portno aren't reported, since they're not there anymore, just in case you thought I wasn't saving my script before I ran it).

    I have a wiry brain/each eye a camera. Robot Tourist, by Ten Benson

      You must be doing something odd (as well as the incorrect () you added) so post your code in its entirity or copy this (works fine)

      my $foo = new Foo; $foo->connect('ip', 8080 ); package Foo; sub new { return bless {}, shift } sub connect { my $self = shift; my ($ip, $port) = @_; print "$self $ip $port"; }

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

        Thanks, I have discovered the problem is in the way I am using Win32::API, sorry. We need people like you to scan for cloaked Romulans, not have to worry about people like me.

        I have a wiry brain/each eye a camera. Robot Tourist, by Ten Benson