From 15c104e23985b21347465208bbf0aef53db3d105 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 13 Nov 2010 20:02:52 -0600 Subject: drop package_ from method names --- lib/Package/Stash.pm | 67 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/Package/Stash.pm b/lib/Package/Stash.pm index f385053..5811d7e 100644 --- a/lib/Package/Stash.pm +++ b/lib/Package/Stash.pm @@ -14,12 +14,57 @@ XSLoader::load( ? ${ $Package::Stash::{VERSION} } : (), ); +use Package::DeprecationManager -deprecations => { + 'Package::Stash::add_package_symbol' => 0.14, + 'Package::Stash::remove_package_glob' => 0.14, + 'Package::Stash::has_package_symbol' => 0.14, + 'Package::Stash::get_package_symbol' => 0.14, + 'Package::Stash::get_or_add_package_symbol' => 0.14, + 'Package::Stash::remove_package_symbol' => 0.14, + 'Package::Stash::list_all_package_symbols' => 0.14, +}; + +sub add_package_symbol { + deprecated('add_package_symbol is deprecated, please use add_symbol'); + shift->add_symbol(@_); +} + +sub remove_package_glob { + deprecated('remove_package_glob is deprecated, please use remove_glob'); + shift->remove_glob(@_); +} + +sub has_package_symbol { + deprecated('has_package_symbol is deprecated, please use has_symbol'); + shift->has_symbol(@_); +} + +sub get_package_symbol { + deprecated('get_package_symbol is deprecated, please use get_symbol'); + shift->get_symbol(@_); +} + +sub get_or_add_package_symbol { + deprecated('get_or_add_package_symbol is deprecated, please use get_or_add_symbol'); + shift->get_or_add_symbol(@_); +} + +sub remove_package_symbol { + deprecated('remove_package_symbol is deprecated, please use remove_symbol'); + shift->remove_symbol(@_); +} + +sub list_all_package_symbols { + deprecated('list_all_package_symbols is deprecated, please use list_all_symbols'); + shift->list_all_symbols(@_); +} + =head1 SYNOPSIS my $stash = Package::Stash->new('Foo'); - $stash->add_package_symbol('%foo', {bar => 1}); + $stash->add_symbol('%foo', {bar => 1}); # $Foo::foo{bar} == 1 - $stash->has_package_symbol('$foo') # false + $stash->has_symbol('$foo') # false my $namespace = $stash->namespace; *{ $namespace->{foo} }{HASH} # {bar => 1} @@ -45,13 +90,13 @@ Returns the name of the package that this object represents. Returns the raw stash itself. -=method add_package_symbol $variable $value %opts +=method add_symbol $variable $value %opts Adds a new package symbol, for the symbol given as C<$variable>, and optionally gives it an initial value of C<$value>. C<$variable> should be the name of variable including the sigil, so - Package::Stash->new('Foo')->add_package_symbol('%foo') + Package::Stash->new('Foo')->add_symbol('%foo') will create C<%Foo::foo>. @@ -71,30 +116,30 @@ determine where the source code for a subroutine can be found. See L for more information about C<%DB::sub>. -=method remove_package_glob $name +=method remove_glob $name Removes all package variables with the given name, regardless of sigil. -=method has_package_symbol $variable +=method has_symbol $variable Returns whether or not the given package variable (including sigil) exists. -=method get_package_symbol $variable +=method get_symbol $variable Returns the value of the given package variable (including sigil). -=method get_or_add_package_symbol $variable +=method get_or_add_symbol $variable -Like C, except that it will return an empty hashref or +Like C, except that it will return an empty hashref or arrayref if the variable doesn't exist. -=method remove_package_symbol $variable +=method remove_symbol $variable Removes the package variable described by C<$variable> (which includes the sigil); other variables with the same name but different sigils will be untouched. -=method list_all_package_symbols $type_filter +=method list_all_symbols $type_filter Returns a list of package variable names in the package, without sigils. If a C is passed, it is used to select package variables of a given -- cgit v1.2.3-54-g00ecf