TERN-it
view release on metacpan or search on metacpan
package TERN::it;
use 5.00000;
use strict;
require Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@EXPORT = qw(
it
exists_it
exists_itA
exists_itH
defined_it
);
$VERSION = '0.01';
# Preloaded methods go here.
my $it;
sub it(){
return $$it;
};
sub defined_it(\$){
return defined(${$it=shift});
};
sub exists_itH(\%$);
sub exists_it(\%$){
my ($hr, $key) = @_;
if (exists $hr->{$key}){
return $it = \$hr->{$key};
}else{
return ${$it = \undef};
};
};
*exists_itH = \&exists_it;
sub exists_itA(\@$){
my ($ar, $key) = @_;
if (exists $ar->[$key]){
return $it = \($ar->[$key]);
}else{
return ${$it = \undef};
};
};
1;
__END__
=head1 NAME
TERN::it - Perl extension for easing nonautovivifying aggregate accesses
=head1 SYNOPSIS
use TERN::it;
it()
exists_it(\%$)
exists_itA(\@)
exists_itH(\%$)
defined_it(\$)
# instead of
# print gen_printable $Data->{$state}->{$city}->{$lastname}->{$firstname}
#
exists_it %Data, $state and
exists_it %{it()}, $city and
exists_it %{it()}, $lastname and
exists_it %{it()}, $firstname and
print gen_printable it;
=head1 DESCRIPTION
$TERN::it is a reserved variable that holds the object of the
( run in 1.069 second using v1.01-cache-2.11-cpan-ff9377addf4 )