Hello talexb,
If you have many modules with such data (really password in modules? I'm sure you are aware already of this..) I'd consider a radical change: parse everything with PPI and produce many distinct modules with a lonely accessor, or better put everything in a db.. anyway..
cat Varz.pm
package Varz;
use Exporter;
our @EXPORT = ( $User, $Password, $Url, $Prefix );
our $User = 'Joe';
our $Password = 'Secret123';
our $Url = 'www.example.com';
our $Prefix = 'EX';
1;
You can just copying vaules from one package to your current one as in:
perl -Mstrict -MVarz -we "our($User, $Password, $Url, $Prefix); map{ $
+main::{$_} = $Varz::{$_} } keys %Varz:: ; print join qq(\n),$User, $
+Password, $Url, $Prefix"
Joe
Secret123
www.example.com
EX
If you want to get a bit mad about symbol table, I recently moved my library
L*
PS you may want to grep out unwanted elements: grep{$_ !~/export|begin/i}keys %Varz::
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|