I have a problem with the Hook::LexWrap module (Version 0.20). Making and installing worked just fine, make test showed me 54 oks and no failures.
But already the code given in the synopsis of the documentation produces a memory access error and the program terminates. I simplified a bit and here is the smallest possible test case which produced the error:
#!/usr/bin/perl use strict; use warnings; use Hook::LexWrap; sub greet { print "Hello, $_[0]!!\n" } # accessing $_[1] or $_[-1] # in pre or post wrapper produces memory access error # # use only one of the following four lines for testing wrap 'greet', pre => sub {print "before: $_[1]\n"}; # wrap 'greet', post => sub {print "after: $_[1]\n"}; # wrap 'greet', pre => sub {print "before: $_[-1]\n"}; # wrap 'greet', post => sub {print "after: $_[-1]\n"}; greet('World');
Accessing any elements in @_ apart from 1 or -1 works as expected giving 'World' for 0 and undef for the rest (2, 3, ...). Furthermore it makes no difference whether I pass the subroutine as a string, a reference or a typeglob to 'wrap'.
My question now: Can anyone reproduces these errors or - even better - has anyone some suggestions on how to fix the problem?
Some infos about my system/perl:
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuratio +n: Platform: osname=linux, osvers=2.2.14, archname=i686-linux uname='linux yeti 2.2.14 #1 mon mar 13 10:51:48 gmt 2000 i686 unkn +own ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LA +RGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.2 19991024 (release)', gccosandvers +='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt - +lutil perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil libc=, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynami +c' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at Oct 22 2001 17:34:23
-- Hofmator
In reply to Memory Access Error with Hook:LexWrap by Hofmator
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |