]> git.vpit.fr Git - perl/modules/Sub-Prototype-Util.git/blobdiff - lib/Sub/Prototype/Util.pm
Importing Sub-Prototype-Util-0.03.tar.gz
[perl/modules/Sub-Prototype-Util.git] / lib / Sub / Prototype / Util.pm
index f090f87be84c8460f2bc030e535d097b1868248e..2e2a5045a6f9fafadfb35492e42bfba9f7c0984c 100644 (file)
@@ -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</flatten> and L</recall> are only exported on request, either by providing their name or by the C<':consts'> and C<':all'> tags.
+The functions L</flatten> and L</recall> 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<Carp> (core module since perl 5), L<Scalar::Util> (since 5.7.3).
+L<Carp>, L<Exporter> (core modules since perl 5), L<Scalar::Util> (since 5.7.3).
 
 =head1 AUTHOR