| MooseX-Declare documentation | Contained in the MooseX-Declare distribution. |
MooseX::Declare::Syntax::Extending - Extending with superclasses
Extends a class by a specified extends option.
Object->add_extends_option_customizations (
Object $ctx,
Str $package,
ArrayRef $superclasses,
HashRef $options
)
This will add a code part that will call extends with the $superclasses
as arguments.
This software is copyright (c) 2010 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| MooseX-Declare documentation | Contained in the MooseX-Declare distribution. |
package MooseX::Declare::Syntax::Extending; BEGIN { $MooseX::Declare::Syntax::Extending::AUTHORITY = 'cpan:FLORA'; } BEGIN { $MooseX::Declare::Syntax::Extending::VERSION = '0.34'; } # ABSTRACT: Extending with superclasses use Moose::Role; use aliased 'MooseX::Declare::Context::Namespaced'; use namespace::clean -except => 'meta'; with qw( MooseX::Declare::Syntax::OptionHandling ); around context_traits => sub { shift->(@_), Namespaced }; sub add_extends_option_customizations { my ($self, $ctx, $package, $superclasses) = @_; # add code for extends keyword $ctx->add_scope_code_parts( sprintf 'extends %s', join ', ', map { "'$_'" } map { $ctx->qualify_namespace($_) } @{ $superclasses }, ); return 1; } 1; __END__