X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Prototype-Util.git;a=blobdiff_plain;f=lib%2FSub%2FPrototype%2FUtil.pm;h=2e2a5045a6f9fafadfb35492e42bfba9f7c0984c;hp=f090f87be84c8460f2bc030e535d097b1868248e;hb=60e38805350346d06fe27a7dee61932e0da22413;hpb=4b145ee918e94698fe49c6e9240d50cfb2a36c75 diff --git a/lib/Sub/Prototype/Util.pm b/lib/Sub/Prototype/Util.pm index f090f87..2e2a504 100644 --- a/lib/Sub/Prototype/Util.pm +++ b/lib/Sub/Prototype/Util.pm @@ -8,15 +8,17 @@ use Scalar::Util qw/reftype/; =head1 NAME -Sub::Prototype::Util - Prototypes-related utility routines. +Sub::Prototype::Util - Prototype-related utility routines. =head1 VERSION -Version 0.01 +Version 0.03 =cut -our $VERSION = '0.01'; +use vars qw/$VERSION/; + +$VERSION = '0.03'; =head1 SYNOPSIS @@ -30,7 +32,7 @@ our $VERSION = '0.01'; =head1 DESCRIPTION -Prototypes are evil, but sometimes you just have to bear with them, especially when messing with core functions. This module provides several utilities aimed at faciliting "overloading" of prototyped functions. +Prototypes are evil, but sometimes you just have to bear with them, especially when messing with core functions. This module provides several utilities aimed at facilitating "overloading" of prototyped functions. They all handle C<5.10>'s C<_> prototype. @@ -78,7 +80,7 @@ sub flatten { } elsif ($p =~ /[\@\%]/) { push @args, @_; last; - } elsif ($p eq '_') { + } elsif ($p eq '_' && @_ == 0) { push @args, $_; } else { push @args, shift; @@ -117,7 +119,7 @@ sub recall { last; } elsif ($p =~ /\&/) { push @args, 'sub{&{$a[' . $i . ']}}'; - } elsif ($p eq '_') { + } elsif ($p eq '_' && $i >= @a) { push @args, '$_'; } else { push @args, '$a[' . $i . ']'; @@ -134,7 +136,7 @@ sub recall { =head1 EXPORT -The functions L and L are only exported on request, either by providing their name or by the C<':consts'> and C<':all'> tags. +The functions L and L are only exported on request, either by providing their name or by the C<':funcs'> and C<':all'> tags. =cut @@ -149,7 +151,7 @@ $EXPORT_TAGS{'all'} = [ @EXPORT_OK ]; =head1 DEPENDENCIES -L (core module since perl 5), L (since 5.7.3). +L, L (core modules since perl 5), L (since 5.7.3). =head1 AUTHOR