http://www.perlmonks.org?node_id=1055162


in reply to Problems with overriding a Perl::Critic policy - SOLVED

Untested. Just an idea:

require Subroutines::RequireArgUnpack; # Add a fake parent. unshift @Subroutines::RequireArgUnpack::ISA = 'Subroutines::RequireArg +Unpack::Fake'; # Put method you want to override in fake parent. *Subroutines::RequireArgUnpack::Fake = \&Subroutines::RequireArgUnpack +::violates; # Override method in original class. *Subroutines::RequireArgUnpack::violates = sub { my ($self, @args) = @_; # Maybe call overriden method. $self->SUPER::violates(@args); };

Replies are listed 'Best First'.
Re^2: Problems with overriding a Perl::Critic policy
by Grimy (Pilgrim) on Sep 22, 2013 at 10:15 UTC
    I don’t understand what you’re trying to do. Care to explain how this idea would allow one to exclude Subroutines::RequireArgUnpack, but to include the subclass? What’s the purpose of the fake parent?