Moose
                                
                                
                                
                                    Moose copied to clipboard
                            
                            
                            
                        support method modifiers for overridden accessor
method modifiers for overrided attribute's accessors(reader/writer/accessor) are not executed when I try to use method modifiers in child class for that.
#!/usr/bin/env perl 
{
    package My;
    use Moose;
    has 'name' =>
    (
        is      => 'ro',
        isa     => 'Str',
        default => 'noname',
        writer  => 'set_name',
    );
    around 'set_name' => sub
    {
        my $orig = shift;
        my $self = shift;
        print __PACKAGE__ . "::set_name\n";
        $self->$orig(@_);
    };
}
{
    package My::Child;
    use Moose;
    extends 'My';
    has '+name' =>
    (
        coerce => 1,
    );
    around 'set_name' => sub
    {
        my $orig = shift;
        my $self = shift;
        print __PACKAGE__ . "::set_name\n";
        $self->$orig(@_);
    };
}
my $mychild = My::Child->new();
printf "Name: %s\n", $mychild->set_name('potatogim');
# before
> perl test.pl
My::Child::set_name
Name: potatogim
# after
> perl test.pl
My::Child::set_name
My::set_name
Name: potatogim
# Test result
> make test
...
t/type_constraints/type_names.t .................................. ok   
t/type_constraints/type_notation_parser.t ........................ ok    
t/type_constraints/types_and_undef.t ............................. ok    
t/type_constraints/union_is_a_type_of.t .......................... ok    
t/type_constraints/union_types.t ................................. ok    
t/type_constraints/union_types_and_coercions.t ................... ok    
t/type_constraints/util_find_type_constraint.t ................... ok    
t/type_constraints/util_more_type_coercion.t ..................... ok    
t/type_constraints/util_std_type_constraints.t ................... ok      
t/type_constraints/util_type_coercion.t .......................... ok    
t/type_constraints/util_type_constraints.t ....................... ok     
t/type_constraints/util_type_constraints_export.t ................ ok   
t/type_constraints/util_type_reloading.t ......................... ok   
t/type_constraints/with-specio.t ................................. ok   
t/type_constraints/with-type-tiny.t .............................. ok   
All tests successful.
Files=477, Tests=17326, 161 wallclock secs ( 2.83 usr  0.66 sys + 146.96 cusr 10.50 csys = 160.95 CPU)
Result: PASS
Signed-off-by: Ji-Hyeon Gim [email protected]
Hello! Could you let me know what kinds of things needed for this PR? 😄