in reply to Can't locate object method
Also watch out for indirect method syntax (which is new Net::Telnet @args as opposed to direct syntax like Net::Telnet->new(@args)[1]) as it's liable to trip you up if you're not exactly sure what it's doing. Here's an example of where it can be fatal
This is a particularly pathological case but it's something to be wary of all the same.package foo; sub new { print "I'm in foo::new()\n"; bless {}, 'foo'; } 1; package main; sub foo { print "I'm in main::foo()\n"; } my $o = new foo; __output__ Bareword found where operator expected at - line 17, near "new foo" (Do you need to predeclare new?) syntax error at - line 17, near "new foo"
_________
broquaint
[1] there's even an argument to use the very explicit Net::Telnet::->new but I don't think I've seen a case yet where it's necessary ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Can't locate object method
by demerphq (Chancellor) on Jun 24, 2002 at 12:19 UTC |