Conflict in defining constant INIT with INIT blocks results in weird errors #10770
Comments
From voropaev.andrey@gmail.comCreated by voropaev.andrey@gmail.comOne of my modules was defining constant INIT. After switching to perl5.12 the module Undefined subroutine &main::Needed called. This didn't make any sense because there's no such function Needed in my module. I could ########################################################### MyPackage::close_cnx(); package MyPackage; use constant INIT => 4; sub close_cnx sub init_action The funniest thing is, if you switch the positions of init_action and close_cnx functions, Perl Info
|
From @ikegamiA simpler test case: $ perl -le'use constant INIT => 4; print(INIT);' Surprisingly, no problems with BEGIN. $ perl -le'use constant BEGIN => 4; print(BEGIN);' constant issues a warning for those if warnings are in use. |
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Wed Oct 27 01:21:39 2010, voropaev.andrey@gmail.com wrote:
This was caused by: commit f746176 Bareword sub lookups |
From [Unknown Contact. See original ticket]On Wed Oct 27 01:21:39 2010, voropaev.andrey@gmail.com wrote:
This was caused by: commit f746176 Bareword sub lookups |
From zefram@fysh.orgFather Chrysostomos via RT wrote:
There's a problem with this line: INIT, as a subroutine name, is magic With the name INIT, funny stuff happens. At some point the constant, I'm not clear on how &Needed gets involved. That part of the reported I believe the fingering of the bareword sub lookup patch is a red herring. -zefram |
From @cpansproutFixed by 75bd28c. |
@cpansprout - Status changed from 'open' to 'resolved' |
From @ap* Zefram <zefram@fysh.org> [2010-11-16 23:00]:
It seems to me that `constant` should warn about this (as well For some reason I even feel it should maybe die… but since Regards, |
Migrated from rt.perl.org#78634 (status was 'resolved')
Searchable as RT78634$
The text was updated successfully, but these errors were encountered: