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=Deparseshows 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
gives you the object, which you can happily call a method on ;-)do { 'FOO'->new }
Kay
In Section
Seekers of Perl Wisdom