This will include $class.pm only once, the first time it is refferenced. Ideal for mod_perl modules. So performance penalty of compiling "use $class .." code is suffered only once.my $class = fetch_from_somewhere; my $object; eval { $object = $class->new; }; if ($@) { eval ("use $class"); die ($@) if $@; $object = $class->new; }
In reply to Re: How do I dynamically declare a package name for
by gildir
in thread How do I dynamically declare a package name for
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |