http://qs321.pair.com?node_id=175484


in reply to package magic or am I missing something?

That's a good one.

It's a wonderful example of indirect object syntax. See The Bag'o'Tricks.
Use B::Deparse shows what happens:
Update: Rather

perl -MO=Deparse
shows what happens:
sub FOO::new { package FOO; use strict 'refs'; } sub FOO::try { package FOO; use strict 'refs'; print "Trying...?\n"; } use strict 'refs'; do { 'FOO'->new }->try;

As you see, the

do { 'FOO'->new }
gives you the object, which you can happily call a method on ;-)

Kay