Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    Mixin::ExtraFields::Driver::HashGuts 0.006

    Download button

    No screenshots available
    Downloads: 262  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Ricardo Signes | More programs
    Perl Artistic License / FREE
    November 14th, 2007, 18:26 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Mixin::ExtraFields::Driver::HashGuts description

    Mixin::ExtraFields::Driver::HashGuts module can store extras in a hashy object's guts.

    Mixin::ExtraFields::Driver::HashGuts module can store extras in a hashy object's guts.

    SYNOPSIS

    package Your::HashBased::Class;

    use Mixin::ExtraFields -fields => { driver => 'HashGuts' };

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

    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.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    extra fields | hash storage | Perl module | hash | storage | driver

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM