Skip Menu |
 

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 124845
Status: patched
Priority: 0/
Queue: Moo

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

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



Subject: "no warnings" not recognized in DEMOLISH
Download (untitled) / with headers
text/plain 974b
(Moo 2.003004, Perl v5.22.1) Howdy! I would like to suppress a warning during object destruction, but DEMOLISH seems to ignore a "no warnings" directive. I've attached code illustrating the behavior. In short, use strict; use warnings; { package MyWarning; use warnings::register; } { package Foo; sub new { bless {}, shift() } sub DESTROY { warnings::warnif( 'MyWarning', 'warning enabled in ' . __PACKAGE__ ); } } suppresses the warnings, but the equivalent Moo class { package MooFoo; use Moo; sub DEMOLISH { warnings::warnif( 'MyWarning', 'warning enabled in ' . __PACKAGE__ ); } } does not. The output of the attached code is: % perl dbi.pl expect warnings warning enabled in MooFoo at (eval 9) line 21. warning enabled in Foo at dbi.pl line 42. expect no warnings warning enabled in MooFoo at (eval 9) line 21. Thanks as always for your efforts! Diab
Subject: dbi.pl
Download dbi.pl
text/x-perl 611b
#!perl use strict; use warnings; { package MyWarning; use warnings::register; } { package Foo; use warnings; sub new { bless {}, shift() } sub DESTROY { warnings::warnif( 'MyWarning', 'warning enabled in ' . __PACKAGE__ ); } } { package MooFoo; use Moo; use warnings; sub DEMOLISH { warnings::warnif( 'MyWarning', 'warning enabled in ' . __PACKAGE__ ); } } print STDERR "\nexpect warnings\n"; { MooFoo->new; Foo->new; } print STDERR "\nexpect no warnings\n"; { no warnings 'MyWarning'; MooFoo->new; Foo->new; }
Fixed in git (d74a8b1).
On Thu Mar 22 12:17:14 2018, haarg wrote: Show quoted text
> Fixed in git (d74a8b1).
Thanks!


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.