Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 96119
Status: resolved
Priority: 0/
Queue: Net-DNS

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

Bug Information
Severity: (no value)
Broken in:
  • 0.76
  • 0.79
Fixed in: (no value)



Subject: Warning if Net::DNS is required
The following warning happens if Net::DNS 0.76 is loaded using require: $ /usr/perl5.20.0/bin/perl -w -e 'require Net::DNS' Too late to run INIT block at /usr/perl5.20.0/lib/site_perl/5.20.0/amd64-freebsd/Net/DNS.pm line 213. This was not the case with perl 5.18.2 and Net::DNS 0.74. Regards, Slaven
From: rwfranks [...] acm.org
The offending INIT block is a temporary feature needed to overcome circular module dependencies inside Net::DNS::SEC 0.17. I could possibly reconsider its merit now that 0.18 is available. However, I am inclined to think this is a more general Perl issue, which is easily reproduced by the following trivial example, which does not involve Net::DNS at all: 2014-06-01 17:25 RT96119/Example.pm package RT96119::Example; INIT { print "INIT block\n"; } 1; __END__ 2014-06-01 17:26 RT96119.pl #!/usr/bin/perl require RT96119::Example; __END__ [devel]$ perl -w RT96119.pl Too late to run INIT block at /home/rwf/devel/RT96119/Example.pm line 5. [devel]$
On 2014-06-01 12:41:05, rwfranks@acm.org wrote: Show quoted text
> The offending INIT block is a temporary feature needed to overcome > circular module dependencies inside Net::DNS::SEC 0.17. I could > possibly reconsider its merit now that 0.18 is available. > > However, I am inclined to think this is a more general Perl issue, > which is easily reproduced by the following trivial example, which > does not involve Net::DNS at all: >
[...] What you can do is to cease this warning category: { no warnings 'void'; INIT { ... } }
From: rwfranks [...] acm.org
On Sun Jun 01 13:29:39 2014, SREZIC wrote: Show quoted text
> What you can do is to cease this warning category:
Which is fine for my purposes. But the general point remains: the INIT block never gets run with "require". The documentation does not make that clear, or if it does, I failed to find it.
On 2014-06-01 14:09:35, rwfranks@acm.org wrote: Show quoted text
> On Sun Jun 01 13:29:39 2014, SREZIC wrote: >
> > What you can do is to cease this warning category:
> > Which is fine for my purposes. > > But the general point remains: the INIT block never gets run with > "require". > > The documentation does not make that clear, or if it does, I failed to > find it.
It is documented in perlmod.pod: The "CHECK" and "INIT" blocks in code compiled by "require", string "do", or string "eval" will not be executed if they occur after the end of the main compilation phase; that can be a problem in mod_perl and other persistent environments which use those functions to load code at runtime. IMHO this restriction limits the usefulness of INIT; it's quite normal to load perl code at runtime.
From: rwfranks [...] acm.org
On Sat Jun 14 04:53:29 2014, SREZIC wrote: Show quoted text
> > It is documented in perlmod.pod:
Thanks. As this can also happen in ordinary Perl scripts, perhaps there should be some words added to the main documentation. 0.77 should be quiet.
Fixed in 0.77
On 2014-06-25 05:10:13, NLNETLABS wrote: Show quoted text
> Fixed in 0.77
The warning appeared again in 0.79: $ /usr/perl5.20.1-RC1/bin/perl -w -e 'require Net::DNS' Too late to run INIT block at /usr/perl5.20.1-RC1/lib/site_perl/5.20.1/amd64-freebsd/Net/DNS.pm line 209.
From: rwfranks [...] acm.org
On Tue Aug 26 02:52:55 2014, SREZIC wrote: Show quoted text
> On 2014-06-25 05:10:13, NLNETLABS wrote:
> > Fixed in 0.77
> > The warning appeared again in 0.79: > > $ /usr/perl5.20.1-RC1/bin/perl -w -e 'require Net::DNS' > Too late to run INIT block at /usr/perl5.20.1- > RC1/lib/site_perl/5.20.1/amd64-freebsd/Net/DNS.pm line 209.
I apologise for failing to notice that perl -w -e 'use Net::DNS' is silent and perl -w -e 'require Net::DNS' gives the warning. The warning is correct in noting that the INIT block will not be executed. The INIT block is only needed to make the Net::DNS::SEC test scripts work; this has no impact on general users. Solution is to rework the code to allow the offending INIT block to be optimised away completely unless using Net::DNS::SEC 0.17 or earlier. Fixed on trunk
Will be fixed in upcoming release 0.80