X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FSub%2FPrototype%2FUtil.pm;h=68ac767034d309c575945a2fb85a893e8a91d53a;hb=8c3d123a078fe87b9b1b20fce287044d3f7f62db;hp=531cdae7bd989c0693a84cc8ef7c6b3ee4b404fc;hpb=bddf69cf5d7e479af6e609e493f344c3b191e69a;p=perl%2Fmodules%2FSub-Prototype-Util.git diff --git a/lib/Sub/Prototype/Util.pm b/lib/Sub/Prototype/Util.pm index 531cdae..68ac767 100644 --- a/lib/Sub/Prototype/Util.pm +++ b/lib/Sub/Prototype/Util.pm @@ -12,13 +12,13 @@ Sub::Prototype::Util - Prototype-related utility routines. =head1 VERSION -Version 0.07 +Version 0.08 =cut use vars qw/$VERSION/; -$VERSION = '0.07'; +$VERSION = '0.08'; =head1 SYNOPSIS @@ -116,15 +116,16 @@ sub _check_name { croak 'No subroutine specified' unless $name; my $proto; my $r = ref $name; - if ($r eq 'HASH') { + if (!$r) { + $proto = prototype $name; + } elsif ($r eq 'HASH') { croak 'Forced prototype hash reference must contain exactly one key/value pair' unless keys %$name == 1; ($name, $proto) = %$name; - } elsif (length $r) { + } else { croak 'Unhandled ' . $r . ' reference as first argument'; } $name =~ s/^\s+//; $name =~ s/[\s\$\@\%\*\&;].*//; - $proto = prototype $name unless $proto; return $name, $proto; } @@ -293,7 +294,7 @@ L, L (core modules since perl 5), L (since 5.7.3). Vincent Pit, C<< >>, L. -You can contact me by mail or on #perl @ FreeNode (vincent or Prof_Vince). +You can contact me by mail or on C (vincent). =head1 BUGS