Filewatcher File Search File Search
Catalog
Content Search
» » » » » »

perl-Data-Rmap

Recursive map, apply a block to a data structure

Recursively evaluate a BLOCK over a list of data structures (locally setting $_ to each element) and return the list composed of the results of such evaluations. $_ can be used to modify the elements.

Data::Rmap currently traverses HASH, ARRAY, SCALAR and GLOB reference types and ignores others. Depending on which rmap_* wrapper is used, the BLOCK is called for only scalar values, arrays, hashes, references, all elements or a customizable combination.

The list of data structures is traversed pre-order in a depth-first fashion. That is, the BLOCK is called for the container reference before is it called for it's elements (although see "recurse" below for post-order). The values of a hash are traversed in the usual "values" order which may affect some applications.

If the "cut" subroutine is called in the BLOCK then the traversal stops for that branch, say if you "cut" an array then the code is never called for it's elements (or their sub-elements). To simultaneously return values and cut, simply pass the return list to cut: "cut('add','to','returned');"

The first parameter to the BLOCK is an object which maintains the state of the traversal. Methods available on this object are described in "State Object" below.

Homepage:
Package version:0.61
Architecture:noarch
Distribution:RPMForge
Filename:perl-Data-Rmap-0.61-1.2.el4.rf.noarch.rpm

/usr/share/doc/perl-Data-Rmap-0.61/README

NAME
    Data::Rmap - recursive map, apply a block to a data structure

SYNOPSIS
     $ perl -MData::Rmap -e 'print rmap { $_ } 1, [2,3], \\4, "\n"'
     1234

     $ perl -MData::Rmap=:all
     rmap_all { print (ref($_) || "?") ,"\n" } \@array, \%hash, \*glob;

     # OUTPUT (Note: a GLOB always has a SCALAR, hence the last two items)
     # ARRAY
     # HASH
     # GLOB
     # SCALAR
     # ?

 
more»

/usr/share/man/man3/Data::Rmap.3pm.gz

Data::Rmap(3)    User Contributed Perl Documentation   Data::Rmap(3)



NAME
       Data::Rmap - recursive map, apply a block to a data structure

SYNOPSIS
        $ perl -MData::Rmap -e 'print rmap { $_ } 1, [2,3], \\4, "\n"'
        1234

        $ perl -MData::Rmap=:all
        rmap_all { print (ref($_) ⎪⎪ "?") ,"\n" } \@array, \%hash, \*glob;

        # OUTPUT (Note: a GLOB always has a SC
more»

/usr/share/doc/perl-Data-Rmap-0.61/Changes

Wed Dec 22 09:04:54 EST 2004
0.61 - Added Test::Exception prereq
Mon Dec 20 15:53:16 EST 2004
0.6  - Allowed for "REF" in tests for 5.8
     - Changed Module::Build usage
Tue May 11 17:00:06 EST 2004
0.5  - added README Changes
     - trim long lines in docs

Browse inside perl-Data-Rmap-0.61-1.2.el4.rf.noarch.rpm

1.85 KB2014-11-28HEADER  view  5 mirrors
         [DIR]usr/ (2)  65535+ mirrors

Download perl-Data-Rmap-0.61-1.2.el4.rf.noarch.rpm

Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017 FileWatcher.com