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.