/usr/share/perl5/MooseX/MethodAttributes/Role/Meta/Role.pm is in libmoosex-methodattributes-perl 0.29-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | package MooseX::MethodAttributes::Role::Meta::Role;
{
$MooseX::MethodAttributes::Role::Meta::Role::VERSION = '0.29';
}
BEGIN {
$MooseX::MethodAttributes::Role::Meta::Role::AUTHORITY = 'cpan:FLORA';
}
# ABSTRACT: metarole role for storing code attributes
use Moose ();
use Moose::Util::MetaRole;
use Moose::Util qw/find_meta does_role ensure_all_roles/;
use Moose::Role;
use MooseX::MethodAttributes ();
use MooseX::MethodAttributes::Role ();
use namespace::autoclean;
with qw/
MooseX::MethodAttributes::Role::Meta::Map
MooseX::MethodAttributes::Role::Meta::Role::Application
/;
$Moose::VERSION >= 0.9301
? around composition_class_roles => sub {
my ($orig, $self) = @_;
return $self->$orig,
'MooseX::MethodAttributes::Role::Meta::Role::Application::Summation';
}
: has '+composition_class_roles' => (
default => sub { [ 'MooseX::MethodAttributes::Role::Meta::Role::Application::Summation' ] },
);
after 'initialize' => sub {
my ($self, $class, %args) = @_;
ensure_all_roles($class, 'MooseX::MethodAttributes::Role::AttrContainer');
};
# FIXME - Skip this logic if the method metaclass already does the right role?
around method_metaclass => sub {
my $orig = shift;
my $self = shift;
return $self->$orig(@_) if scalar @_;
Moose::Meta::Class->create_anon_class(
superclasses => [ $self->$orig ],
roles => [qw/
MooseX::MethodAttributes::Role::Meta::Method
/],
cache => 1,
)->name();
};
sub _copy_attributes {
my ($self, $thing) = @_;
push @{ $thing->_method_attribute_list }, @{ $self->_method_attribute_list };
@{ $thing->_method_attribute_map }{ (keys(%{ $self->_method_attribute_map }), keys(%{ $thing->_method_attribute_map })) }
= (values(%{ $self->_method_attribute_map }), values(%{ $thing->_method_attribute_map }));
};
# This allows you to say use Moose::Role -traits => 'MethodAttributes'
# This is replaced by MooseX::MethodAttributes::Role, and this trait registration
# is now only present for backwards compatibility reasons.
package # Hide from PAUSE
Moose::Meta::Role::Custom::Trait::MethodAttributes;
sub register_implementation { 'MooseX::MethodAttributes::Role::Meta::Role' }
1;
__END__
=pod
=encoding UTF-8
=for :stopwords Florian Ragwitz Tomas Doran Dave Karman (t0m) Rolsky David Steinbrunner
Karen Etheridge Marcus Ramberg Peter E metarole initialisation
=head1 NAME
MooseX::MethodAttributes::Role::Meta::Role - metarole role for storing code attributes
=head1 VERSION
version 0.29
=head1 SYNOPSIS
package MyRole;
use MooseX::MethodAttributes::Role;
sub foo : Bar Baz('corge') { ... }
package MyClass
use Moose;
with 'MyRole';
my $attrs = MyClass->meta->get_method('foo')->attributes; # ["Bar", "Baz('corge')"]
=head1 DESCRIPTION
This module is a metaclass role which is applied by L<MooseX::MethodAttributes::Role>, allowing
you to add code attributes to methods in Moose roles.
These attributes can then be found by introspecting the role metaclass, and are automatically copied
into any classes or roles that the role is composed onto.
=head1 METHODS
=head2 initialize
Ensures that the package containing the role methods does the
L<MooseX::MethodAttributes::Role::AttrContainer> role during initialisation,
which in turn is responsible for capturing the method attributes on the class
and registering them with the metaclass.
=head2 method_metaclass
Wraps the normal method and ensures that the method metaclass performs the
L<MooseX::MethodAttributes::Role::Meta::Method> role, which allows you to
introspect the attributes from the method objects returned by the MOP when
querying the metaclass.
=head1 CAVEATS
=over
=item *
Currently roles with attributes cannot have methods excluded
or aliased, and will in turn confer this property onto any roles they
are composed onto.
=back
=head1 AUTHORS
=over 4
=item *
Florian Ragwitz <rafl@debian.org>
=item *
Tomas Doran <bobtfish@bobtfish.net>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2009 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.
=cut
|