-
-
10 Sep 2014 22:39:55 UTC
- Distribution: Class-Method-ModifiersX-Augment
- Module version: 0.002
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (945 / 6 / 1)
- Kwalitee
Bus factor: 1- 93.67% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (16.22KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
MooX::Augment - adds "augment method => sub {...}" support to Moo
SYNOPSIS
use v5.14; use strict; use Test::More; package Document { use Moo; use MooX::Augment -class; has recipient => (is => 'ro'); sub as_xml { sprintf "<document>%s</document>", inner } } package Greeting { use Moo; use MooX::Augment -class; extends qw( Document ); augment as_xml => sub { sprintf "<greet>%s</greet>", inner } } package Greeting::English { use Moo; use MooX::Augment -class; extends qw( Greeting ); augment as_xml => sub { my $self = shift; sprintf "Hello %s", $self->recipient; } } my $obj = Greeting::English->new(recipient => "World"); is( $obj->as_xml, "<document><greet>Hello World</greet></document>", ); done_testing();
DESCRIPTION
MooX::Augment extends Moo with the
augment
method modifier, allowing you to use this Moose abomination for augmenting superclass methods in Moo classes.You need to indicate whether you are using this within a Moo class or a Moo role:
use MooX::Augment -class; use MooX::Augment -role;
Note that Moo roles cannot provide
augment
method modifiers. Roles may importinner
though it has not been thoroughly tested and may be of limited utility.See Class::Method::ModifiersX::Augment for further details.
SEE ALSO
Moo, Class::Method::ModifiersX::Augment.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
This software is copyright (c) 2012 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::Augment, copy and paste the appropriate command in to your terminal.
cpanm Class::Method::ModifiersX::Augment
perl -MCPAN -e shell install Class::Method::ModifiersX::Augment
For more information on module installation, please visit the detailed CPAN module installation guide.