Softpedia
 


LINUX CATEGORIES:



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

    Tie::Proxy::Hash 1.01

    Download button

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

    License / Price:

    Last Updated:

    Category:
    Martyn J. Pearce | More programs
    Perl Artistic License / FREE
    July 5th, 2007, 20:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Tie::Proxy::Hash description

    Tie::Proxy::Hash is a Perl module created to efficiently merge & translate hashes.

    Tie::Proxy::Hash is a Perl module created to efficiently merge & translate hashes.

    SYNOPSIS

    my (%hash, $ref);
    $ref = tie %hash, 'Tie::Proxy::Hash', (bart => +{a => 1,
    b => 2},
    maggie => +{a => 5,
    c => 6,
    e => 10},
    );
    $hash{a} == 1; # true
    $hash{b} == 2; # true (bart supercedes maggie)
    $hash{c} == 6; # true
    ! defined $hash{d}; # true
    $hash{e} == 10; # true

    $hash{c} = 9; # set in maggie
    $hash{d} = 12; # set in default
    $hash{f} = 11; # set in default

    $ref->add_hash('lisa', +{d => 3, b => 4});
    $hash{c} == 9; # true
    $hash{b} == 2; # true (bart overrides lisa)
    $hash{d} == 3; # true (lisa overrides default)
    $hash{f} == 11; # true (only default knows 'f')

    Proxy hash requests for one or more other hashes, with intermediate value translation.

    Tie::Proxy::Hash 'merges' hashes by maintaining a list of hashes to look up, and each key requested is looked up in each hash in order until a hit is found. Resultant values may be subject to a translating subr. In this way, hashes may be merged without the cost of by-value copying.

    A default backing hash is provided to store values not present in other hashes.

    Tying

    $ref = tie %hash, 'Tie::Proxy::Hash',
    bart => +{a => 1, b => 2},
    maggie => +{a => 5, c => 6, e => 10} => sub {10*$_[0]},
    ;

    Any arguments passed to tie are palmed off onto add_hash.

    Retrieving Values

    Values are retrieved by checking each hash in the order of insertion; the first hash found in which a given key exists supplies the value. The value is subject to translation if the given hash has an associated translator.

    Requirements:

    · Perl



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    merge hashes | translate hashes | Perl module | Tie::Proxy::Hash | merge | translate

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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