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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.