1#!/usr/bin/env perl 2use strict; 3use warnings; 4use Test::More tests => 3; 5 6my %trigger; 7do { 8 package Class; 9 use Mouse; 10 11 for my $attr (qw/a b c/) { 12 has $attr => ( 13 is => 'rw', 14 trigger => sub { 15 $trigger{$attr}++; 16 }, 17 ); 18 } 19}; 20 21can_ok(Class => qw/a b c/); 22is_deeply([sort Class->meta->get_attribute_list], [sort qw/a b c/], "three attributes created"); 23Class->new(a => 1, b => 2); 24 25is_deeply(\%trigger, { a => 1, b => 1 }, "correct triggers called"); 26 27