NAME
Package::Localize - localize package variables in other packages
SYNOPSIS
Say you've got this pesky package someone wrote that decided to use globals:
Whenever you call Foo::inc()
,
it'll always be increasing that $var
, even if
you call it from different places. Package::Localize
to the rescue:
DESCRIPTION
This module allows you to use multple instances of packages that have package variables operated by the functions the module offers.
Currently there is no support for OO modules; functions only.
METHODS
new
my $p1 = Package::Localize->new('Foo');
Takes one mandatory argument which is the name of the package you want to localize.
Returns an object. Call functions from your original package as methods on this object to operate on localizes package variables only.
name
my $name = $p1->name;
no strict 'refs';
my $p1_var = ${"$name::var"};
Returns the name of the localized package.
BUGS AND CAVEATS
Currently there is no support for OO modules; functions only. Patches are definitely welcome though.
SEE ALSO
REPOSITORY
BUGS
AUTHOR
LICENSE
You can use and distribute this module under the same terms as Perl itself.
See the LICENSE
file included in this distribution for complete
details.