Numeric-LL_Array
view release on metacpan or search on metacpan
LL_Array.pm view on Meta::CPAN
package Numeric::LL_Array;
require Exporter;
@ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use Numeric::LL_Array ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
%EXPORT_TAGS = ( 'all' => [ qw(
) ] );
@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
@EXPORT = qw(
);
$VERSION = '0.1504';
my %exported;
sub import {
my($p, $f, $tr, $P, @e, $renew) = ( shift, (caller)[1], {}, (caller(0))[0] );
for my $sym (@_) {
$tr{$1} = $2, $tr_c .= $1, $rx = qr/[$tr_c]/, next
if $sym =~ /^:(\w)=(\w)$/;
push @e, $sym and next if $sym =~ /^\d/; # Somebody required a Version
my $Sym = $sym; # Some values may be read-only
$Sym =~ s/(access_|packId_(?:star_)?)(.)$/ $1 . ($tr{$2} || $2) /e
or $Sym =~ s/^(.)(?=0_)/ $tr{$1} || $1 /e
or $Sym =~ s/^(.)2(.)(?=1_)/ ($tr{$1} || $1) . 2 . ($tr{$2} || $2) /e
or $Sym =~ s/^(.)(.)2(.)(?=2_)/
($tr{$1} || $1) . ($tr{$2} || $2) . 2 . ($tr{$3} || $3) /e;
# warn +(caller(0))[0] . " p=$p, f=$f\n" if $Sym ne $sym;
create_handler(__PACKAGE__ . "::$Sym", $f)
unless defined &{__PACKAGE__ . "::$Sym"};
# For translated symbols, we could not go through Exporter
*{"$P\::$sym"} = \&{__PACKAGE__ . "::$Sym"}, next if $sym ne $Sym;
push @e, $Sym; # Otherwise, go through Exporter - at least, for version
}
defined &{__PACKAGE__ . "::$_"}
and ( $exported{$_}++ or ++$renew, push @EXPORT_OK, $_ ) for @e;
# change to %EXPORT_OK ignored unless Exporter cache is invalidated
undef %EXPORT if $renew;
# warn "EXPORT_OK: @EXPORT_OK\n";
Exporter::export($p, $P, @e);
}
use strict;
eval {
require XSLoader;
XSLoader::load('Numeric::LL_Array', $Numeric::LL_Array::VERSION);
1;
} or do {
require DynaLoader;
push @Numeric::LL_Array::ISA, 'DynaLoader';
bootstrap Numeric::LL_Array $Numeric::LL_Array::VERSION;
};
# Preloaded methods go here.
%Numeric::LL_Array::duplicateTypes = split //, duplicateTypes();
@Numeric::LL_Array::typeSizes{split //, typeNames()} = map ord, split //, typeSizes();
%Numeric::LL_Array::translateTypes = %Numeric::LL_Array::duplicateTypes;
@Numeric::LL_Array::translateTypes{split //, typeNames()} = split //, typeNames();
$Numeric::LL_Array::typeSizes{$_}
= $Numeric::LL_Array::typeSizes{$Numeric::LL_Array::duplicateTypes{$_}}
for keys %Numeric::LL_Array::duplicateTypes;
my %sizePack;
eval { $sizePack{length pack $_, 0} ||= $_ } for qw(c s! s i l! l q);
my(%packId, $t);
$t = $sizePack{$Numeric::LL_Array::typeSizes{$_} || 'nonesuch'}
and $packId{$_} = $t and $packId{uc $_} = uc $t for qw(c s i l q);
$packId{format} = $t if $t = $sizePack{ptrdiff_t_size()};
$packId{$_} = $_ for grep defined $Numeric::LL_Array::typeSizes{$_}, qw(f d D);
sub packId ($) { my($t,$r) = shift; $r = $packId{$t} and return $r;
die "Type `$t' not handable via Perl pack()"}
sub packId_star ($) { packId(shift) . '*' }
( run in 0.792 second using v1.01-cache-2.11-cpan-99c4e6809bf )