Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the Class-Autouse CPAN distribution.

Report information
The Basics
Id: 18533
Status: resolved
Priority: 0/
Queue: Class-Autouse

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

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



Subject: Remove unnecessarily complex _UPDATE_CAN
Download (untitled) / with headers
text/plain 348b
As I was looking through the code I noticed the eval and such to have two versions, one for below 5.6 and one above. The only difference is to use warnings.pm or $^W. Since the subroutine is just one assignment statement it really makes no difference. This patch just makes one simple version of the function eliminiating a bunch of complexity.
Subject: eval.patch
Download eval.patch
text/x-diff 1.3k
Tue Apr 4 10:00:58 EDT 2006 Michael G Schwern <schwern@pobox.com> * Remove unnecessarily complex _UPDATE_CAN() Its not worth all the trouble to have two different versions of _UPDATE_CAN just to have one with "no warnings" and one with "local $^W = 0". The former works fine in both cases and the subroutine consists of just an assignment. diff -rN -u old-Class-Autouse-1.24/lib/Class/Autouse.pm new-Class-Autouse-1.24/lib/Class/Autouse.pm --- old-Class-Autouse-1.24/lib/Class/Autouse.pm 2006-04-04 10:16:28.000000000 -0400 +++ new-Class-Autouse-1.24/lib/Class/Autouse.pm 2006-04-04 10:16:28.000000000 -0400 @@ -553,17 +553,10 @@ # The _UPDATE_CAN function is intended to turn our hijacking of UNIVERSAL::can # on or off, depending on whether we have any live hooks. The idea being, if we # don't have any live hooks, why bother intercepting UNIVERSAL::can calls? -BEGIN { eval( $] >= 5.006 ? <<'END_NEW_PERL' : <<'END_OLD_PERL'); die $@ if $@ } sub _UPDATE_CAN () { - no warnings; - *UNIVERSAL::can = $HOOKS ? *_can{CODE} : *_UNIVERSAL_can{CODE}; + local $^W = 0; + *UNIVERSAL::can = $HOOKS ? *_can{CODE} : *_UNIVERSAL_can{CODE}; } -END_NEW_PERL -sub _UPDATE_CAN () { - local $^W = 0; - *UNIVERSAL::can = $HOOKS ? *_can{CODE} : *_UNIVERSAL_can{CODE}; -} -END_OLD_PERL BEGIN { # Optional integration with prefork.pm (if installed)


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.