NAME
Symbol::Glob - remove items from the symbol table, painlessly
VERSION
This document describes Symbol::Glob version 0.01
SYNOPSIS
use Symbol::Glob;
# assumes current package unless specified
my $glob = Symbol::Glob->new({ name => 'foo' });
$glob->scalar(14);
$glob->sub( sub { return 'this is a sub' });
print $Some::Package::foo; # prints 14
$glob->delete('scalar');
print $Some::Package::foo; # undefined
print $glob->sub->(); # prints 'this is a sub'
$glob->delete; # removes entire glob
DESCRIPTION
Symbol::Glob
provides a simple interface to manipulate Perl's symbol table. You can define and undefine symbol table entries for scalars, arrays, hashes, and subs via simple method calls.
This module does not (currently) attempt to mess with filehandles, dirhandles, or formats.
INTERFACE
new
Creates the new Symbol::Glob
object. This method is automatically generated by Class::Std
.
Arguments
Arguments are supplied as key/value pairs in an anonymous hash as per Class::Std
interface standards.
name
The name of the glob you wish to manipulate. In this release, we suggest you fully qualify the name of the glob. The use of
__PACKAGE__
is handy for this purpose.scalar
A scalar value to be assigned to the corresponding scalar variable associated with this glob.
array
An anonymous array or array reference whose contents are placed into the array associated with this glob.
hash
An anonymous hash or hash reference whose contents are placed into the hash associated with this glob.
sub
An anonymous sub or subroutine reference to be associated with the subroutine name defined by this glob.
BUILD
Called by Class::Std
's new
method; you should not call this method directly yourself. Performs the necessary object initialization.
scalar
When supplied a scalar value, sets the scalar entry in this typeglob to the given value. As a side effect, the scalar variable associated with this typeglob name comes into being if it did not already exist, and is assigned the same value.
When supplied no value, the value of the scalar associated with this slot (if any) is returned.
hash
When supplied a hash value, sets the hash entry in this typeglob to the given value. As a side effect, the hash variable associated with this typeglob name comes into being if it did not already exist.
When supplied no value, a reference to the hash associated with this slot (if any) is returned in scalar context; the contents are returned in list context.
array
When supplied a array value, sets the array entry in this typeglob to the given value. As a side effect, the array variable associated with this typeglob name comes into being if it did not already exist.
When supplied no value, a reference to the array associated with this slot (if any) is returned in scalar context; the array contents are returned in list context.
sub
When supplied a code reference, sets the sub entry in this typeglob to the given value. As a side effect, the subroutine associated with this typeglob name comes into being if it did not already exist.
When supplied no value, a reference to the sub associated with this slot (if any) is returned in either scalar or list context.
delete
If no argument is supplied, the entire typeglob (and all associated variables and code) is deleted.
If an argument is supplied, it must be one of 'scalar', 'hash', 'array', or 'sub'. The corresponding slot in the typeglob is deleted, removing that item from the symbol table.
DIAGNOSTICS
No typeglob name supplied
-
You did not specify a
name
in your call tonew
. You must name the typeglob you want to access to create aSymbol::Glob
object. You can't fill in a %s with a %s
-
You will see this message if you try to supply an argument that doesn't match to a
Symbol::Glob
method; for example, trying to put a hash into an array slot.
CONFIGURATION AND ENVIRONMENT
Symbol::Glob requires no configuration files or environment variables.
DEPENDENCIES
None.
INCOMPATIBILITIES
None reported.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-symbol-glob@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
AUTHOR
Joe McMahon <mcmahon@yahoo-inc.com >
LICENCE AND COPYRIGHT
Copyright (c) 2005, Joe McMahon <mcmahon@yahoo-inc.com >
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.