Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Wrong package used when method and package have the same name

by ikegami (Patriarch)
on May 02, 2006 at 14:13 UTC ( [id://546896]=note: print w/replies, xml ) Need Help??


in reply to Wrong package used when method and package have the same name

It's a known limitation of the indirect method call syntax. Instead of
new Example::Foo::One('arg' => 'value')
use
Example::Foo::One->new('arg' => 'value')

Update: Thanks blazaar and davorg. It's easy to miss things when one has just woken up.

I think changing
Example::Foo::One
to
Example::Foo::One::
will do the trick.

>perl -le "$c = Example::Foo::One::; print $c" Example::Foo::One

Replies are listed 'Best First'.
Re^2: Wrong package used when method and package have the same name
by davorg (Chancellor) on May 02, 2006 at 14:19 UTC

    That's was my initial thought too. But then I tried it and found that it still didn't work correctly (although it failed in a different manner). And, in fact, the original poster had already tried that to.

    If the syntax of the line is changed to this:

    my $one = Example::Foo::One->new('arg' => 'value');

    the same error occurs (albeit with a different error message).

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      aye, I've just realized that. I was on my way to update my post.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://546896]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-25 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found