Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 39852
Status: resolved
Priority: 0/
Queue: libwww-perl

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

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



Subject: HTTP::Message - CPU wasted by handling DESTROY in AUTOLOAD
In HTTP::Message, DESTROY is currently being handled in AUTOLOAD, which imposes a needless "return if $method eq "DESTROY";" call in every AUTOLOAD method, and a needless "my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2);" variable allocation in every DESTROY call. A minor speed increase in both DESTROY and autoloaded calls could be gained by adding a simple line. sub DESTROY { return }
commit 6a90a5d24dd46f2c438199782fea8e35cd23966f Author: Gisle Aas <gisle@aas.no> Date: Tue Oct 7 10:08:24 2008 +0200 Avoid invoking AUTOLOAD on object destruction [RT#39852] diff --git a/lib/HTTP/Message.pm b/lib/HTTP/Message.pm index 618acab..8f24b3d 100644 --- a/lib/HTTP/Message.pm +++ b/lib/HTTP/Message.pm @@ -403,7 +403,6 @@ sub _stale_content { sub AUTOLOAD { my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2); - return if $method eq "DESTROY"; # We create the function here so that it will not need to be # autoloaded the next time. @@ -413,6 +412,9 @@ sub AUTOLOAD } +sub DESTROY {} # avoid AUTOLOADing it + + # Private method to access members in %$self sub _elem {