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 reply to Re: package magic or am I missing something?
by janx
in thread package magic or am I missing something?
by vladb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |