Skip Menu |

This queue is for tickets about the Hook-LexWrap CPAN distribution.

Report information
The Basics
Id: 39745
Status: open
Priority: 0/
Queue: Hook-LexWrap

People
Owner: CHORNY [...] cpan.org
Requestors: rybskej [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.20
Fixed in: (no value)



Subject: Function prototypes are lost
When perl warnings are enabled as a switch on the command line (-w), Hook::LexWrap spews "Prototype mismatch" un-suppressible warnings for every doit() call. Attached script hl_test.pl exemplifies this. Even if this warning were suppressible in such circumstances, prototypes should still be retained. Recommended patch (hl_prototype.patch) reads the prototype from the original function, if any existed, and applies it to the new function.
Subject: hl_test.pl
#!/usr/bin/perl -w no warnings; use Hook::LexWrap; sub doit (;$) { print "[doit:", caller, "]"; return {my=>"data"} } SCOPED: { wrap doit, pre => sub { print "[pre1: @_]\n" }, post => sub { print "[post1:@_]\n"; $_[1]=9; }; my $temporarily = wrap doit, post => sub { print "[post2:@_]\n" }, pre => sub { print "[pre2: @_]\n "}; my @args = (1,2,3); doit(@args); # pre2->pre1->doit->post1->post2 } my @args = (4,5,6); doit(@args); # pre1->doit->post1
Subject: hl_prototype.patch
--- /Library/Perl/5.8.8/Hook/LexWrap.pm 2001-10-01 02:51:03.000000000 -0400 +++ /Library/Perl/5.8.8/Hook/LexWrap.pm.new 2008-10-01 13:21:04.000000000 -0400 @@ -2,6 +2,7 @@ our $VERSION = '0.20'; use 5.006; use Carp; +use Scalar::Util 1.11; *CORE::GLOBAL::caller = sub { my ($height) = ($_[0]||0); @@ -65,6 +66,9 @@ return; } }; + if (my $proto = prototype($original)) { + Scalar::Util::set_prototype \&$imposter, $proto; + } ref $typeglob eq 'CODE' and return defined wantarray ? $imposter : carp "Uselessly wrapped subroutine reference in void context";
Subject: perl_platform.txt
Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=darwin, osvers=9.0, archname=darwin-thread-multi-2level uname='darwin b70.apple.com 9.0 darwin kernel version 9.0.0: mon dec 3 11:36:03 pst 2007; root:xnu-1228.0.1~4release_i386 i386 ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include', optimize='-O3', cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include' ccversion='', gccversion='4.0.1 (Apple Inc. build 5465)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc -mmacosx-version-min=10.5.1', ldflags ='-arch i386 -arch ppc -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-arch i386 -arch ppc -bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Locally applied patches: fix for regcomp CVE-2007-5116 security vulnerability Built under darwin Compiled at Jan 13 2008 20:35:11 @INC: /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .