Skip Menu |
 

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 132889
Status: new
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.55
Fixed in: (no value)



Subject: Sub::Util::set_prototype doesn't work at MODIFY_CODE_ATTRIBUTES time
Download (untitled) / with headers
text/plain 1.1k
It is too early. This (silently!) fails to set the prototype: *MODIFY_CODE_ATTRIBUTES = sub { my ( $pkg, $code, @attrs ) = @_; my @ret; foreach my $attr ( @attrs ) { if( $attr =~ m/^prototype\((.*)\)$/ ) { my $prototype = "$1"; Sub::Util::set_prototype( $prototype, $code ); next; } push @ret, $attr; } return @ret; }; This sort of work around by deferring it to UNITCHECK time is required: my @prototypes; *MODIFY_CODE_ATTRIBUTES = sub { my ( $pkg, $code, @attrs ) = @_; my @ret; foreach my $attr ( @attrs ) { if( $attr =~ m/^prototype\((.*)\)$/ ) { my $prototype = "$1"; push @prototypes, [ $code, $prototype ]; next; } push @ret, $attr; } return @ret; }; UNITCHECK { foreach ( @prototypes ) { my ( $code, $prototype ) = @$_; Sub::Util::set_prototype( $_->[1], $_->[0] ); } } -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.