andal has asked for the wisdom of the Perl Monks concerning the following question:
The gentoo has upgraded perl to perl-5.12 and immidiately one of my modules stopped to work. The error was somewhat weird, so after playing with deleting pieces of code I reduced everything to the following 2 files
try.pl
#!/usr/bin/perl use strict; use MyPackage; MyPackage::close_cnx();
MyPackage.pm
package MyPackage; use strict; use constant INIT => 4; sub close_cnx { my $self = shift; init_action($self); } sub init_action { my $self = shift; return if $self->{Needed} <= $self->{count}; callit($self->{ID}, INIT); } 1;
An attempt to execute "try.pl" results in the message
Undefined subroutine &main::Needed called. INIT failed--call queue aborted.
Enabling warnings clarifies, that the problem may be from the conflicting use with the INIT block. But if such use is so disastrous, why is it not a syntax error? Are there some reasons to have it only as warning?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Conflict with INIT block is not an error?
by toolic (Bishop) on Oct 26, 2010 at 13:29 UTC | |
|
Re: Conflict with INIT block is not an error?
by Anonymous Monk on Oct 26, 2010 at 14:07 UTC | |
by ikegami (Patriarch) on Oct 26, 2010 at 16:41 UTC |