Subject: | immutable constructors don't call triggers |
New test attached:
t/300_immutable/007_immutable_trigger_from_constructor.t
--
Rafael
Subject: | 007_immutable_trigger_from_constructor.t |
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 2;
BEGIN {
use_ok('Moose');
}
{
package AClass;
use Moose;
has 'foo' => (is => 'rw', isa => 'Maybe[Str]', trigger => sub {
die "Pulling the trigger\n"
});
__PACKAGE__->meta->make_immutable;
no Moose;
}
eval { AClass->new(foo => 'bar') };
like ($@, qr/^Pulling the trigger/, "trigger from immutable constructor");