2xlp has asked for the wisdom of the Perl Monks concerning the following question:
package main; use warnings; use strict; use lib '/'; use com_2xlp::Test::SuperClass ();
package com_2xlp::Test::SuperClass; use warnings; use strict; use Module::List::Pluggable(); our %_REGISTERED_NETWORKS; Module::List::Pluggable::import_modules( "com_2xlp::Test" ); sub register_subclass { my ($package)= @_; print $package; print $package::var; } 1;
in the code above ( i created a /com_2xlp dir to simplify namespace issues on testing ) the subclass module will correctly call register_subclass -- evidenced by the print command. however the package vars are uninitialized if i try to address $package::var . similarly, perl will toss errors if i try to require $package or anything similar, unable to find the package.package com_2xlp::Test::SuperClass::SubClass; use warnings; use strict; our $var= "var"; com_2xlp::Test::SuperClass::register_subclass(__PACKAGE__); 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dynamically Requiring Perl Modules
by shmem (Chancellor) on Nov 18, 2007 at 12:45 UTC | |
by 2xlp (Sexton) on Nov 19, 2007 at 18:01 UTC |