The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mixin::ExtraFields::Driver::HashGuts - store extras in a hashy object's guts

VERSION

version 0.003

 $Id: HashGuts.pm 26352 2006-12-11 15:41:08Z rjbs $

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 => "\0Something\0Wicked\0" }
  };

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.

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.