NAME

MooX::Override - adds "override method => sub {...}" support to Moo

SYNOPSIS

use v5.14;
use strict;
use Test::More;

package Foo {
   use Moo;
   sub foo { return "foo" }
}

package Bar {
   use Moo::Role;
   use MooX::Override -role;
   override foo => sub {
      return uc super;
   };
}

package Foo::Bar {
   use Moo;
   extends qw(Foo);
   with qw(Bar);
}

is( Foo::Bar->new->foo, "FOO" );
done_testing();

DESCRIPTION

MooX::Override extends Moo and Moo::Role with the override method modifier, allowing you to use this Moose syntactic sugar for overriding superclass methods in Moo classes.

You need to indicate whether you are using this within a Moo class or a Moo role:

use MooX::Override -class;
use MooX::Override -role;

See Class::Method::ModifiersX::Override for further details.

SEE ALSO

Moo, Moo::Role, Class::Method::ModifiersX::Override.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2012, 2014, 2017 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.