return bless {}, ref $pkg || $pkg;
This technique has been the basis of at least one recent "cargo cult" discussion. There are mixed opinions over whether overloading a class constructor is a prudent thing to do.
In this post, merlyn points out a cleaner way to get the same effect, without overloading your class constructor.
In reply to Re^3: Problem with My New Perl Object
by dws
in thread Problem with My New Perl Object
by arunhorne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |