develooper Front page | perl.perl5.porters | Postings from April 2013

[perl #117661] perlfunc/perlpacktut pack w documentation

Thread Next
schmorp @ schmorp . de
April 18, 2013 15:05
[perl #117661] perlfunc/perlpacktut pack w documentation
Message ID:
# New Ticket Created by 
# Please include the string:  [perl #117661]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.39 running under perl 5.16.3.

[Please describe your issue here]

perldoc -f pack tells us:

   w  A BER compressed integer (not an ASN.1 BER, see perlpacktut for details).

Ok, it's not an ASN.1 BER integer, still, it's an ASN.1 BER subidentifier
(and is happily used to decode these in e.g. Net::SNMP).

Anyways, heading to perlpacktut to see why there is strong negation of
it's ASN.1 BER qualities, I find... nothing.

The only thing I can find is "Another Portable Binary Encoding", which tells us:

   (Details can be found at <>, the Scarab project.)

Apparently, that domain fell off the internet in 2008. Looking at it
in the wayback machine still shows that there are no details at that
URL. At all. If there ever was, it must have been buried deep inside that
domain at some other URL. It looks more like some shameless plug for some
project, and in any case, perl now refers to some kind of recycling shop
or so.


   There is no size limit to BER encoding, but Perl won't go to extremes.

Well, last I looked, perl went very well to extremes when decoding these
gems, as it implements it's own multi-precision multiplication function
so it can decode BER integers of arbitrary lentgh into decimal string
form. Of course, whether that's going to extremes is another question, but
to me, that's quite surprising, and, if officially supported, quite a nice

Here are my suggestions to improve this situation:

1. drop the "not an ASN.1 BER" comment, or at least qualify it, like
   "like an ASN.1 BER subidentifier, not a BER integer".

   At the very least the description of BER subidentifier encoding in
   X.209:198811 6.22 is much more concise than any I found in the perl
   documentation, so saying it isn't an ASN.1 BER is more confusing than
   helpful, because by all means it is.

2. remove the url in perlpacktut.

3. document the fact that perl will go to multiprecision arithmetic when
   decoding these values (but not when encoding them), and that treating
   these decoded values as numbers in perl might reduce their precision.


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

Configured by Marc Lehmann at Wed Mar 13 11:30:24 CET 2013.

Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
    osname=linux, osvers=3.2.0-4-amd64, archname=x86_64-linux
    uname='linux cerebro 3.2.0-4-amd64 #1 smp debian 3.2.35-2 x86_64 gnulinux '
    config_args='-Duselargefiles -Duse64bitint -Dusemymalloc=n -Dstatic_ext=Fcntl -Dcc=gcc -Dccflags=-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -USITEARCH_EXP -USITELIB_EXP -UARCHLIB_EXP -D_GNU_SOURCE  -I/opt/include -ggdb -gdwarf-2 -g3 -Doptimize=-O6 -fno-asynchronous-unwind-tables -fno-strict-aliasing -Dcccdlflags=-fPIC -Dldflags=-L/opt/perl/lib -L/opt/lib -Dlibs=-ldl -lm -lcrypt -Dprefix=/opt/perl -Dprivlib=/opt/perl/lib/perl5 -Darchlib=/opt/perl/lib/perl5 -Uusevendorprefix -Dsiteprefix=/opt/perl -Dsitelib=/opt/perl/lib/perl5 -Dsitearch=/opt/perl/lib/perl5 -Dsitebin=/opt/perl/bin -Dman1dir=/opt/perl/man/man1 -Dman3dir=/opt/perl/man/man3 -Dsiteman1dir=/opt/perl/man/man1 -Dsiteman3dir=/opt/perl/man/man3 -Dman1ext=1 -Dman3ext=3 -Dpager=/usr/bin/less -Uafs -Uusesfio -Uusenm -Uuseshrplib -Ud_dosuid -Dusethreads=undef -Duse5005threads=undef -Duseithreads=undef -Dusemultiplicity=undef -Dcf_by=Marc Lehmann -Dlocincpth=/o
 pt/perl/include /opt/include -Dmyhostname=localhost -Dmultiarch=undef -Dbin=/opt/perl/bin -Dxxxusedevel -DxxxDEBUGGING -Dxxxuse_debugging_perl -Dxxxuse_debugmalloc -dEs'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='gcc', ccflags ='-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -USITEARCH_EXP -USITELIB_EXP -UARCHLIB_EXP -D_GNU_SOURCE -I/opt/include -ggdb -gdwarf-2 -g3 -fno-strict-aliasing -pipe -I/opt/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O6 -fno-asynchronous-unwind-tables -fno-strict-aliasing',
    cppflags='-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -USITEARCH_EXP -USITELIB_EXP -UARCHLIB_EXP -D_GNU_SOURCE -I/opt/include -ggdb -gdwarf-2 -g3 -fno-strict-aliasing -pipe -I/opt/include'
    ccversion='', gccversion='4.7.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/opt/perl/lib -L/opt/lib -L/usr/local/lib'
    libpth=/usr/local/lib /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
    libs=-ldl -lm -lcrypt
    perllibs=-ldl -lm -lcrypt
    libc=, 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 -O6 -fno-asynchronous-unwind-tables -fno-strict-aliasing -L/opt/perl/lib -L/opt/lib -L/usr/local/lib'

Locally applied patches:

@INC for perl 5.16.3:

Environment for perl 5.16.3:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About