every time I used this code. So, naturally, I thought, I'd just re-export those from the core:use Base::Module; Base::Module::Config->import(qw( %conf ));
This comes deceptively close to working, but I'm seeing some users of Base::Module getting one %conf and others getting a different %conf. I suspect that it's related to whether they import it usingpackage Base::Module; use strict; use warnings; sub config_module { "Base::Module::Config" } use base 'Exporter'; BEGIN { our @EXPORT_OK = qw( &%conf ); eval 'require ' . config_module; no strict 'refs'; no warnings 'once'; *conf = \%{config_module . '::conf'}; }
oruse Base::Module qw( %conf );
but I'm not positive. It could also be the distinction between being used in the final program (first form) vs. being used by other modules which are a part of this structure (second form).sub base_module { "Base::Module" } BEGIN { eval 'require ' . base_module; base_module()->import(qw( %conf )); }
In any case, what would be the correct (or at least a fully-working) way to accomplish this?
In reply to Re-exporting dynamically-included variables by dsheroh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |