in reply to Perl OO: switch package context.
Otherwise: it's possible to have Class be a constant, in your package, with value "My::Package::Class". that ought to work too. Well, in my tests, it does. :)
package My::Package; use constant Class => __PACKAGE__ . '::Class'; print ref Class->new; # prints "My::Package::Class" { package My::Package::Class; sub new { return bless {}, shift; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl OO: switch package context.
by sorhed (Acolyte) on May 15, 2005 at 13:03 UTC | |
by bart (Canon) on May 15, 2005 at 20:45 UTC |