X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Prototype-Util.git;a=blobdiff_plain;f=lib%2FSub%2FPrototype%2FUtil.pm;h=11eeb91395a79e2ad1db7a54ea992916075e194d;hp=531cdae7bd989c0693a84cc8ef7c6b3ee4b404fc;hb=cdcb726f9c5b8e0414ea40052350331c72c637c8;hpb=bddf69cf5d7e479af6e609e493f344c3b191e69a diff --git a/lib/Sub/Prototype/Util.pm b/lib/Sub/Prototype/Util.pm index 531cdae..11eeb91 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; }