Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mixin::extrafields::driver::hashguts(3pm) [debian man page]

Mixin::ExtraFields::Driver::HashGuts(3pm)		User Contributed Perl Documentation		 Mixin::ExtraFields::Driver::HashGuts(3pm)

NAME
Mixin::ExtraFields::Driver::HashGuts - store extras in a hashy object's guts VERSION
version 0.008 SYNOPSIS
package Your::HashBased::Class; use Mixin::ExtraFields -fields => { driver => 'HashGuts' }; DESCRIPTION
This driver class implements an extremely simple storage mechanism: extras are stored on the object on which the mixed-in methods are called. By default, they are stored under the key returned by the "default_has_key" method, but this can be changed by providing a "hash_key" argument to the driver configuration, like so: use Mixin::ExtraFields -fields => { driver => { class => 'HashGuts', hash_key => "SomethingWicked" } }; METHODS
In addition to the methods required by Mixin::ExtraFields::Driver, the following methods are provided: hash_key my $key = $driver->hash_key; This method returns the key where the driver will store its extras. default_hash_key If no "hash_key" argument is given for the driver, this method is called during driver initialization. It will return a unique string to be used as the hash key. storage This method returns the hashref of storage used for extras. Individual objects get weak references to their id within this hashref. storage_for my $stash = $driver->storage_for($object, $id); This method returns the hashref to use to store extras for the given object and id. This hashref is stored on both the hash-based object (in its "hash_key" entry) and on the driver (in the entry for $id in its "storage" hash). All objects with the same id should end up with the same hash in their "hash_key" field. None of these references are weakened, which means two things: first, even if all objects with a given id go out of scope, future objects with that id will retain the original extras; secondly, memory used to store extras is never reclaimed. If this is a problem, use a more sophisticated driver. AUTHOR
This code was written by Ricardo SIGNES. His code in 2006 was sponsored by Listbox. COPYRIGHT AND LICENSE
Copyright (C) 2006, Ricardo SIGNES. This code is free software, and is available under the same terms as perl itself. perl v5.10.1 2010-01-19 Mixin::ExtraFields::Driver::HashGuts(3pm)

Check Out this Related Man Page

Mixin::Linewise::Readers(3pm)				User Contributed Perl Documentation			     Mixin::Linewise::Readers(3pm)

NAME
Mixin::Linewise::Readers - get linewise readers for strings and filenames SYNOPSIS
package Your::Pkg; use Mixin::Linewise::Readers -readers; sub read_handle { my ($self, $handle) = @_; LINE: while (my $line = $handle->getline) { next LINE if $line =~ /^#/; print "non-comment: $line"; } } Then: use Your::Pkg; Your::Pkg->read_file($filename); Your::Pkg->read_string($string); Your::Pkg->read_handle($fh); EXPORTS
"read_file" and "read_string" are exported by default. Either can be requested individually, or renamed. They are generated by Sub::Exporter, so consult its documentation for more information. Both can be generated with the option "method" which requests that a method other than "read_handle" is called with the created IO::Handle. read_file Your::Pkg->read_file($filename); If generated, the "read_file" export attempts to open the named file for reading, and then calls "read_handle" on the opened handle. Any arguments after $filename are passed along after to "read_handle". read_string Your::Pkg->read_string($string); If generated, the "read_string" creates an IO::String handle from the given string, and then calls "read_handle" on the opened handle. Any arguments after $string are passed along after to "read_handle". BUGS
Bugs should be reported via the CPAN bug tracker at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mixin-Linewise> For other issues, or commercial enhancement or support, contact the author. AUTHOR
Ricardo SIGNES, "<rjbs@cpan.org>" COPYRIGHT
Copyright 2008, Ricardo SIGNES. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-02-14 Mixin::Linewise::Readers(3pm)
Man Page