Quoth the Camel (3ed, p927):
You used the syntax of a method call, but the slot filled by the objec +t reference or package name contains an expression that returns a def +ined value that is neither an object reference nor a package name. So +mething like this will reproduce the error: $BADREF = 42; process $BADREF 1,2,3; $BADREF->process(1,2,3);
To make a long story short, you probably have a package named Voice, with a method named Calendar(). Instead of a class method invocation, you're calling &Voice::Calendar(), which returns something that is a true value, but not an object reference or package. Example:
$ perl -e 'package Foo::Bar; sub Foo {1}; sub Foo::Bar {1}; package ma +in; Foo::Bar->Foo' Can't call method "Foo" without a package or object reference at -e li +ne 1.
To prevent this confusion, you can quote the package name:
'Foo::Bar'->Foo
conv
Update: Of course there's a package named Voice, I should read more carefully.
For fun: You could also have made the Calendar() method in the Voice package return 'Voice::Calendar', which Perl would take as the package name, but that would probably break other stuff. (:
In reply to Re: Problem with calling method new
by converter
in thread Problem with calling method new
by Sinister
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |