develooper Front page | perl.perl5.porters | Postings from January 2009

[perl #62696] pack/unpack error

Anatoly Grishaev
January 25, 2009 06:02
[perl #62696] pack/unpack error
Message ID:
# New Ticket Created by  Anatoly Grishaev 
# Please include the string:  [perl #62696]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from gtoly@toh-dev.localdomain,
generated with the help of perlbug 1.36 running under perl 5.10.0.

[Please enter your report here]

Can't unpack packed before string

Here code:
my $str = pack "w/a(w/a)*", "Hello";
print unpack "w/a(w/a)*", $str;
>> '/' must follow a numeric type in unpack at ...

This also don't work
print join ":", 
   unpack "N/a(w/a)*", 
     pack "N/a(w/a)*", "Hello"

and this don't work 
   print join q[:],unpack q[n(w/a)*], pack q[n(w/a)*], 1

And this works

print join ":",
   unpack "(w/a)*",
     pack "(w/a)*";

And this also works

print join ":",
   unpack "w/a(w/a)*",
     pack "w/a(w/a)*", "Hello", 'World';

And this works strange:
   unpack "(nn)*", pack "n*", 1 
   produce (1), but here must warnings or error or empty list

All code in one-line:

perl -e "print join q[:],unpack q[n(w/a)*], pack q[n(w/a)*], 1"
perl -e "print join q[:],unpack q[n/a(w/a)*], pack q[n/a(w/a)*], q[a]"
perl -e "print join q[:],unpack q[w/a(w/a)*], pack q[w/a(w/a)*], q[a]"

perl -e "print join q[:],unpack q[(w/a)*], pack q[(w/a)*], "
perl -e "print join q[:],unpack q[(w/a)*], pack q[(w/a)*], q[]"
perl -e "print join q[:],unpack q[(nn)*], pack q[(n)*], 1"

[Please do not change anything below this line]
Site configuration information for perl 5.10.0:

Configured by gtoly at Sat Nov  1 16:44:39 MSK 2008.

Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
    osname=linux, osvers=, archname=x86_64-linux-thread-multi
    uname='linux toh-dev #2 smp mon oct 6 15:36:34 msd 2008 x86_64 amd opteron(tm) processor 852 authenticamd gnulinux '
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='4.1.2 (Gentoo 4.1.2 p1.0.2)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O3 -L/usr/local/lib'

Locally applied patches:

@INC for perl 5.10.0:

Environment for perl 5.10.0:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL5OPT= -M5.010 -MData::Dumper -MExtUtils::testlib
    PERL_BADLANG (unset)
    SHELL=/bin/bash Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About