Stash::Manip - routines for manipulating stashes
version 0.02
my $stash = Stash::Manip->new('Foo'); $stash->add_package_symbol('%foo', {bar => 1}); # $Foo::foo{bar} == 1 $stash->has_package_symbol('$foo') # false my $namespace = $stash->namespace; *{ $namespace->{foo} }{HASH} # {bar => 1}
Manipulating stashes (Perl's symbol tables) is occasionally necessary, but incredibly messy, and easy to get wrong. This module hides all of that behind a simple API.
NOTE: Most methods in this class require a variable specification that includes a sigil. If this sigil is absent, it is assumed to represent the IO slot.
Creates a new Stash::Manip object, for the package given as the only argument.
Stash::Manip
Returns the name of the package that this object represents.
Returns the raw stash itself.
Adds a new package symbol, for the symbol given as $variable, and optionally gives it an initial value of $value. $variable should be the name of variable including the sigil, so
$variable
$value
Stash::Manip->new('Foo')->add_package_symbol('%foo')
will create %Foo::foo.
%Foo::foo
Removes all package variables with the given name, regardless of sigil.
Returns whether or not the given package variable (including sigil) exists.
Returns the value of the given package variable (including sigil).
Removes the package variable described by $variable (which includes the sigil); other variables with the same name but different sigils will be untouched.
Returns a list of package variable names in the package, without sigils. If a type_filter is passed, it is used to select package variables of a given type, where valid types are the slots of a typeglob ('SCALAR', 'CODE', 'HASH', etc).
type_filter
No known bugs.
Please report any bugs through RT: email bug-stash-manip at rt.cpan.org, or browse to http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Stash-Manip.
bug-stash-manip at rt.cpan.org
Class::MOP::Package - this module is a factoring out of code that used to live here
You can find this documentation for this module with the perldoc command.
perldoc Stash::Manip
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Stash-Manip
CPAN Ratings
http://cpanratings.perl.org/d/Stash-Manip
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Stash-Manip
Search CPAN
http://search.cpan.org/dist/Stash-Manip
Jesse Luehrs <doy at tozt dot net>
Mostly copied from code from Class::MOP::Package, by Stevan Little and the Moose Cabal.
This software is copyright (c) 2010 by Jesse Luehrs.
This is free software; you can redistribute it and/or modify it under the same terms as perl itself.
To install Stash::Manip, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Stash::Manip
CPAN shell
perl -MCPAN -e shell install Stash::Manip
For more information on module installation, please visit the detailed CPAN module installation guide.