NAME
Data::Dmap - just like map, but on deep data structures
VERSION
Version 0.01
SYNOPSIS
This module provides the single function dmap
which carries out a map
-like operation on deep data structures.
use Data::Dmap;
my $foo = {
cars => [ 'ford', 'opel', 'BMW' ],
birds => [ 'cuckatoo', 'ostrich', 'frigate' ],
handler => sub { print "barf\n" }
};
# This removes all keys named 'cars'
my($bar) = dmap { delete $_->{cars} if ref eq 'HASH'; $_ } $foo;
# This replaces arrays with the number of elements they contains
my($other) = dmap { $_ = scalar @$_ if ref eq 'ARRAY'; $_ } $foo;
use Data::Dumper;
print Dumper $other;
#
# Prints
# {
# birds => 3,
# handler => sub { "DUMMY" }
# }
# (Data::Dumper doesn't dump subs)
$other->{handler}->();
# Prints
# barf
EXPORT
SUBROUTINES/METHODS
dmap
AUTHOR
Michael Zedeler, <"michael@zedeler.dk">
BUGS
If you find a bug, please consider helping to fix the bug by doing this:
- Fork
Data::Dmap
from http://github.com/mzedeler/Data-Dmap - Write a test case in the
t
directory, commit and push it. - Fix the bug or (if you don't know how to fix it), report the bug
Bugs and feature requests can be reported through the web interface at http://github.com/mzedeler/Data-Dmap/issues. I may not be notified, so send me a mail too.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Data::Dmap
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2010 "Michael Zedeler".
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.