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: 18669
Status: resolved
Priority: 0/
Queue: Class-Autouse

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

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



Subject: "Useless use of a constant in void context" in 5.6 from DEBUG
Download (untitled) / with headers
text/plain 2.3k
The DEBUG change in 1.25 throws warnings in ActiveState's 5.6.1 (I have not tried a stock 5.6 as I don't have one available). Sorry, I should have checked it out. Simply loading the module produces... Useless use of a constant in void context at lib/Class/Autouse.pm line 77. Useless use of a constant in void context at lib/Class/Autouse.pm line 96. Useless use of a constant in void context at lib/Class/Autouse.pm line 123. Useless use of a constant in void context at lib/Class/Autouse.pm line 182. Useless use of a constant in void context at lib/Class/Autouse.pm line 211. Useless use of a constant in void context at lib/Class/Autouse.pm line 221. Useless use of a constant in void context at lib/Class/Autouse.pm line 230. Useless use of a constant in void context at lib/Class/Autouse.pm line 244. Useless use of a constant in void context at lib/Class/Autouse.pm line 266. Useless use of a constant in void context at lib/Class/Autouse.pm line 371. Useless use of a constant in void context at lib/Class/Autouse.pm line 399. Useless use of a constant in void context at lib/Class/Autouse.pm line 414. Useless use of a constant in void context at lib/Class/Autouse.pm line 476. Useless use of a constant in void context at lib/Class/Autouse.pm line 495. Useless use of a constant in void context at lib/Class/Autouse.pm line 520. Useless use of a constant in void context at lib/Class/Autouse.pm line 539. Useless use of a constant in void context at lib/Class/Autouse.pm line 17. Each of those corresponds to an "if DEBUG". Its some 5.6 bug (possibly confined to ActiveState's version) where if a constant is set to undef it will throw the above warning. $ perl -wle 'use constant FOO => undef; print "This" if FOO' Useless use of a constant in void context at -e line 1. Patch attached to make sure $DEBUG is always defined. --- Class-Autouse-1.25/lib/Class/Autouse.pm Fri Apr 7 05:27:53 2006 +++ Class-Autouse-1.25.fixed/lib/Class/Autouse.pm Tue Apr 11 16:25:27 2006@@ -13,6 +13,9 @@ # Handle debugging switch via a constant to allow debugging # to be optimised out at compile time if not needed. use vars qw{$DEBUG}; +# Avoid a 5.6 bug where a constant set to undef throws a "useless use of +# constant in void context" warning. +BEGIN { $DEBUG ||= 0 } use constant DEBUG => $DEBUG; print "Class::Autouse::autoload -> Debugging Activated.\n" if DEBUG;
Subject: Re: [rt.cpan.org #18669] "Useless use of a constant in void context" in 5.6 from DEBUG
Date: Wed, 12 Apr 2006 14:16:08 +1000
To: bug-Class-Autouse [...] rt.cpan.org
From: Adam Kennedy <adam [...] phase-n.com>
Damn it, I knew there was a reason. The trouble with some of this stuff is that I'm fairly certain almost every character in C:A is there for a reason at this point. :) I just don't always remember what that reason is any more. But I think that's why it was defined DEBUG originally. Adam K Michael_G_Schwern via RT wrote: Show quoted text
> Tue Apr 11 19:28:25 2006: Request 18669 was acted upon. > Transaction: Ticket created by MSCHWERN > Queue: Class-Autouse > Subject: "Useless use of a constant in void context" in 5.6 from DEBUG > Owner: Nobody > Requestors: MSCHWERN@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=18669 > > > > The DEBUG change in 1.25 throws warnings in ActiveState's 5.6.1 (I have > not tried a stock 5.6 as I don't have one available). Sorry, I should > have checked it out. Simply loading the module produces... > > Useless use of a constant in void context at lib/Class/Autouse.pm line 77. > Useless use of a constant in void context at lib/Class/Autouse.pm line 96. > Useless use of a constant in void context at lib/Class/Autouse.pm line 123. > Useless use of a constant in void context at lib/Class/Autouse.pm line 182. > Useless use of a constant in void context at lib/Class/Autouse.pm line 211. > Useless use of a constant in void context at lib/Class/Autouse.pm line 221. > Useless use of a constant in void context at lib/Class/Autouse.pm line 230. > Useless use of a constant in void context at lib/Class/Autouse.pm line 244. > Useless use of a constant in void context at lib/Class/Autouse.pm line 266. > Useless use of a constant in void context at lib/Class/Autouse.pm line 371. > Useless use of a constant in void context at lib/Class/Autouse.pm line 399. > Useless use of a constant in void context at lib/Class/Autouse.pm line 414. > Useless use of a constant in void context at lib/Class/Autouse.pm line 476. > Useless use of a constant in void context at lib/Class/Autouse.pm line 495. > Useless use of a constant in void context at lib/Class/Autouse.pm line 520. > Useless use of a constant in void context at lib/Class/Autouse.pm line 539. > Useless use of a constant in void context at lib/Class/Autouse.pm line 17. > > Each of those corresponds to an "if DEBUG". Its some 5.6 bug (possibly > confined to ActiveState's version) where if a constant is set to undef > it will throw the above warning. > > $ perl -wle 'use constant FOO => undef; print "This" if FOO' > Useless use of a constant in void context at -e line 1. > > Patch attached to make sure $DEBUG is always defined. > > --- Class-Autouse-1.25/lib/Class/Autouse.pm Fri Apr 7 05:27:53 2006 > +++ Class-Autouse-1.25.fixed/lib/Class/Autouse.pm Tue Apr 11 > 16:25:27 2006@@ -13,6 +13,9 @@ > # Handle debugging switch via a constant to allow debugging > # to be optimised out at compile time if not needed. > use vars qw{$DEBUG}; > +# Avoid a 5.6 bug where a constant set to undef throws a "useless use of > +# constant in void context" warning. > +BEGIN { $DEBUG ||= 0 } > use constant DEBUG => $DEBUG; > print "Class::Autouse::autoload -> Debugging Activated.\n" if DEBUG; >


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.