Skip to content

Instantly share code, notes, and snippets.

@j1n3l0
Created April 15, 2010 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j1n3l0/367501 to your computer and use it in GitHub Desktop.
Save j1n3l0/367501 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use 5.10.0;
use warnings;
{
package Foo;
use Moose;
local $SIG{__WARN__} = sub { };
has private => ( isa => 'Int' );
has bar => (
isa => 'Int',
is => 'rw',
trigger => \&update,
);
sub update { say 'the value of bar is ', shift->bar }
no Moose;
1;
}
my $foo = Foo->new();
$foo->bar($_) for 1 .. 5;
warn 'warns but does not die';
exit 0;
@j1n3l0
Copy link
Author

j1n3l0 commented Apr 15, 2010

how to switch off warnings in a moose class (if you must), see here for motivation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment