Data::Diver 1.0101
Sponsored Links
Data::Diver 1.0101 Ranking & Summary
File size:
0.008 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
813
Date added:
2007-08-02
Publisher:
Tye McQueen
Data::Diver 1.0101 description
Data::Diver is a simple, ad-hoc access to elements of deeply nested structures.
SUMMARY
Data::Diver provides the Dive() and DiveVal() functions for ad-hoc access to elements of deeply nested data structures, and the DiveRef(), DiveError(), DiveClear(), and DiveDie() support functions.
SYNOPSIS
use Data::Diver qw( Dive DiveRef DiveError );
my $root= {
top => [
{ first => 1 },
{ second => {
key => [
0, 1, 2, {
three => {
exists => yes,
},
},
],
},
},
],
};
# Sets $value to yes
# ( $root->{top}[1]{second}{key}[3]{three}{exists} ):
my $value= Dive( $root, qw( top 1 second key 3 three exists ) );
# Sets $value to undef() because "missing" doesnt exist:
$value= Dive( $root, qw( top 1 second key 3 three missing ) );
# Sets $value to undef() because
# $root->{top}[1]{second}{key}[4] is off the end of the array:
$value= Dive( $root, qw( top 1 second key 4 ... ) );
# Sets $value to undef() because
# $root->{top}[1]{second}{key}[-5] would be a fatal error:
$value= Dive( $root, qw( top 1 second key -5 ... ) );
# Sets $ref to $root->{top}[9]{new}{sub} (which grows
# @{ $root->{top} } and autovifies two anonymous hashes):
my $ref= DiveRef( $root, qw( top 9 new sub ) );
# die()s because "other" isnt a valid number:
$ref= DiveRef( $root, qw( top other ... ) );
# Does: $root->{num}{1}{2}= 3;
# (Autovivifies hashes despite the numeric keys.)
DiveVal( $root, ( qw( num 1 2 ) ) ) = 3;
# Same thing:
${ DiveRef( $root, num, 1, 2 ) } = 3;
# Retrieves above value, $value= 3:
$value= DiveVal( $root, num, 1, 2 );
# Same thing:
$value= ${ DiveRef( $root, ( qw( num 1 2 ) ) ) };
# Tries to do $root->{top}{1} and dies
# because $root->{top} is an array reference:
DiveRef( $root, top, 1 );
# To only autovivify at the last step:
$ref= DiveRef(
Dive( $root, qw( top 1 second key 3 three ) ),
missing );
if( $ref ) {
$$ref= me too
} else {
my( $nestedRef, $svKey, $errDesc )= DiveError();
die "Couldnt dereference $nestedRef via $$svKey: $errDescn";
}
SUMMARY
Data::Diver provides the Dive() and DiveVal() functions for ad-hoc access to elements of deeply nested data structures, and the DiveRef(), DiveError(), DiveClear(), and DiveDie() support functions.
SYNOPSIS
use Data::Diver qw( Dive DiveRef DiveError );
my $root= {
top => [
{ first => 1 },
{ second => {
key => [
0, 1, 2, {
three => {
exists => yes,
},
},
],
},
},
],
};
# Sets $value to yes
# ( $root->{top}[1]{second}{key}[3]{three}{exists} ):
my $value= Dive( $root, qw( top 1 second key 3 three exists ) );
# Sets $value to undef() because "missing" doesnt exist:
$value= Dive( $root, qw( top 1 second key 3 three missing ) );
# Sets $value to undef() because
# $root->{top}[1]{second}{key}[4] is off the end of the array:
$value= Dive( $root, qw( top 1 second key 4 ... ) );
# Sets $value to undef() because
# $root->{top}[1]{second}{key}[-5] would be a fatal error:
$value= Dive( $root, qw( top 1 second key -5 ... ) );
# Sets $ref to $root->{top}[9]{new}{sub} (which grows
# @{ $root->{top} } and autovifies two anonymous hashes):
my $ref= DiveRef( $root, qw( top 9 new sub ) );
# die()s because "other" isnt a valid number:
$ref= DiveRef( $root, qw( top other ... ) );
# Does: $root->{num}{1}{2}= 3;
# (Autovivifies hashes despite the numeric keys.)
DiveVal( $root, ( qw( num 1 2 ) ) ) = 3;
# Same thing:
${ DiveRef( $root, num, 1, 2 ) } = 3;
# Retrieves above value, $value= 3:
$value= DiveVal( $root, num, 1, 2 );
# Same thing:
$value= ${ DiveRef( $root, ( qw( num 1 2 ) ) ) };
# Tries to do $root->{top}{1} and dies
# because $root->{top} is an array reference:
DiveRef( $root, top, 1 );
# To only autovivify at the last step:
$ref= DiveRef(
Dive( $root, qw( top 1 second key 3 three ) ),
missing );
if( $ref ) {
$$ref= me too
} else {
my( $nestedRef, $svKey, $errDesc )= DiveError();
die "Couldnt dereference $nestedRef via $$svKey: $errDescn";
}
Data::Diver 1.0101 Screenshot
Data::Diver 1.0101 Keywords
DiveRef
Diver 1.0101
DiveError
DiveVal
top 1
access to
1 second
1
top
root
value
QW
second
Data::Diver
DataDiver
Data::Diver 1.0101
Bookmark Data::Diver 1.0101
Data::Diver 1.0101 Copyright
WareSeeker periodically updates pricing and software information of Data::Diver 1.0101 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Data::Diver 1.0101 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
Data::Inherited is a Perl module with hierarchy-wide accumulation of list and hash results. Free Download
Data::Dumper module contains stringified perl data structures, suitable for both printing and eval. Free Download
Data::Type is a Perl module with versatile data and value types. Free Download
Data::Stag is a Perl module with structured tags datastructures. Free Download
Test::Data is a Perl module to test functions for particular variable types. Free Download
Data::PropertyList is a Perl module that can convert arbitrary objects to/from strings. Free Download
Scalar::Number is a Perl module with numeric aspects of scalars. Free Download
DBIx::DataModel is a Perl module with Classes and UML-style Associations on top of DBI. Free Download
Latest Software
Popular Software
Favourite Software