-
-
07 Feb 2017 13:48:36 UTC
- Distribution: Class-Method-ModifiersX-Override
- Module version: 0.003
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (521 / 0 / 0)
- Kwalitee
Bus factor: 1- 80.00% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity
24 month- Tools
- Download (15.14KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- NAME
- SYNOPSIS
- DESCRIPTION
- CAVEATS
- BUGS
- DEPENDENCIES
- SEE ALSO
- AUTHOR
- COPYRIGHT AND LICENCE
- DISCLAIMER OF WARRANTIES
NAME
Class::Method::ModifiersX::Override - adds "override method => sub {...}" support to Class::Method::Modifiers
SYNOPSIS
use v5.14; use strict; use Test::More; package Foo { sub new { bless []=> shift } sub foo { return "foo" } } package Foo::Bar { BEGIN { our @ISA = 'Foo' } use Class::Method::ModifiersX::Override; override foo => sub { return uc super; }; } is( Foo::Bar->new->foo, "FOO" ); done_testing();
(Note that the synopsis shows Perl v5.14+ syntax for package declaration, but this module and its accompanying Moo and Role::Tiny wrappers support Perl v5.8 and above.)
DESCRIPTION
Class::Method::ModifiersX::Override extends Class::Method::Modifiers with the
override
method modifier, allowing you to use this Moose syntactic sugar for overriding superclass methods in non-Moose classes.See Moose::Manual::MethodModifiers for details of how
override
and its companion functionsuper
work.This module exports two functions:
If you want to use these with Moo classes or role, or with Role::Tiny roles, please look at MooX::Override or Role::TinyX::Override instead.
CAVEATS
This implementation of
override
piggybacks onto Class::Method::Modifiers' implementation ofaround
. As a result, when multiple method modifiers are applied to the same method, the order in which they are applied might not match Moose, whereoverride
modifiers are "innermost".Given that this implementation of
override
piggybacks ontoaround
, there's almost no reason to use it; you can just usearound
instead. This module mostly exists as an answer to people who complain that Moo doesn't supportoverride
/super
, but it may also be helpful porting Moose code to Moo.BUGS
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Class-Method-ModifiersX-Override.
DEPENDENCIES
Class::Method::ModifiersX::Override requires Perl 5.008, and the Class::Method::Modifiers package (which is available from CPAN).
The accompanying modules MooX::Override and Role::TinyX::Override require Moo and Role::Tiny respectively. However, the installation scripts for this distribution do not check that these are installed. If you use MooX::Override or Role::TinyX::Override, it is assumed that you have installed their dependencies separately.
SEE ALSO
Moose::Manual::MethodModifiers, Class::Method::Modifiers, MooX::Override, Role::TinyX::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.
Module Install Instructions
To install Class::Method::ModifiersX::Override, copy and paste the appropriate command in to your terminal.
cpanm Class::Method::ModifiersX::Override
perl -MCPAN -e shell install Class::Method::ModifiersX::Override
For more information on module installation, please visit the detailed CPAN module installation guide.