in reply to Re: Re (tilly) 3: Filehandles vs. Packages: And the winner is...
in thread Filehandles vs. Packages: And the winner is...

Oops, not what I was thinking at all!

Here are shorter example demonstrating the bug in more detail:

perl -e 'sub new{print@_} main->new(); open main, "foo";' perl -e 'sub new{print@_} main->main::new(); open main,"foo";'
And the message from the second one gives a pretty solid indication what is going wrong. (I think that this is perlbug material.)

UPDATE
Since tye complained, the outputs respectively are:

Can't locate object method "new" via package "IO::Handle" at -e line 1 +. GLOB(0x80d4208)