summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorMarcus Holland-Moritz <mhx-perl@gmx.net>2012-05-23 14:50:31 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-05-23 17:59:22 -0700
commit21361d0729743e699b2954b542f05a2e4eabd980 (patch)
treeb4f46494969725415a45b9c85172af1ba8cf0d24 /pp_pack.c
parent909564a7d63dd41ca03b7bc9659d8c7b695220d2 (diff)
downloadperl-21361d0729743e699b2954b542f05a2e4eabd980.tar.gz
[perl #60204] Unhelpful error message from unpack
Nigel Sandever said: > The error message produced by the following snippets is very unhelpful: > > c:\>perl -wle"print unpack 'v/a*', qq[a]" > '/' must follow a numeric type in unpack at -e line 1. > > c:\>perl -wle"print unpack 'v/a*', ''" > '/' must follow a numeric type in unpack at -e line 1. > > c:\>perl -wle"print unpack 'v/a*', ' '" > '/' must follow a numeric type in unpack at -e line 1. The "problem" is that the data string is too short. But unpack doesn't generate a warning (or croak) in this case for simple patterns: mhx@r2d2 $ perl -MData::Dumper -we'print Dumper([unpack "n", "a"])' $VAR1 = []; So, I'd say your code should just behave in exactly the same way. No warning, no return values.
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp_pack.c b/pp_pack.c
index 71dc22d67d..9f1c83a34b 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -2234,7 +2234,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
if (symptr->flags & FLAG_SLASH){
if (SP - PL_stack_base - start_sp_offset <= 0)
- Perl_croak(aTHX_ "'/' must follow a numeric type in unpack");
+ break;
if( next_symbol(symptr) ){
if( symptr->howlen == e_number )
Perl_croak(aTHX_ "Count after length/code in unpack" );