line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Meta::Role::Application::ToInstance; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2205'; |
3
|
|
|
|
|
|
|
|
4
|
377
|
|
|
377
|
|
3183
|
use strict; |
|
377
|
|
|
|
|
1168
|
|
|
377
|
|
|
|
|
12111
|
|
5
|
377
|
|
|
377
|
|
2419
|
use warnings; |
|
377
|
|
|
|
|
1067
|
|
|
377
|
|
|
|
|
10083
|
|
6
|
377
|
|
|
377
|
|
2397
|
use metaclass; |
|
377
|
|
|
|
|
1135
|
|
|
377
|
|
|
|
|
2754
|
|
7
|
|
|
|
|
|
|
|
8
|
377
|
|
|
377
|
|
3315
|
use Scalar::Util 'blessed'; |
|
377
|
|
|
|
|
1231
|
|
|
377
|
|
|
|
|
24655
|
|
9
|
377
|
|
|
377
|
|
2984
|
use List::Util 1.33 'all'; |
|
377
|
|
|
|
|
9015
|
|
|
377
|
|
|
|
|
27949
|
|
10
|
377
|
|
|
377
|
|
3363
|
use Devel::OverloadInfo 0.004 'is_overloaded'; |
|
377
|
|
|
|
|
8635
|
|
|
377
|
|
|
|
|
24200
|
|
11
|
|
|
|
|
|
|
|
12
|
377
|
|
|
377
|
|
2921
|
use parent 'Moose::Meta::Role::Application'; |
|
377
|
|
|
|
|
1228
|
|
|
377
|
|
|
|
|
2808
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
__PACKAGE__->meta->add_attribute('rebless_params' => ( |
15
|
|
|
|
|
|
|
reader => 'rebless_params', |
16
|
|
|
|
|
|
|
default => sub { {} }, |
17
|
|
|
|
|
|
|
Class::MOP::_definition_context(), |
18
|
|
|
|
|
|
|
)); |
19
|
|
|
|
|
|
|
|
20
|
377
|
|
|
377
|
|
50991
|
use constant _NEED_OVERLOAD_HACK_FOR_OBJECTS => "$]" < 5.008009; |
|
377
|
|
|
|
|
1182
|
|
|
377
|
|
|
|
|
113654
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub apply { |
23
|
23
|
|
|
23
|
1
|
103
|
my ( $self, $role, $object, $args ) = @_; |
24
|
|
|
|
|
|
|
|
25
|
23
|
|
100
|
|
|
83
|
my $obj_meta = Class::MOP::class_of($object) || 'Moose::Meta::Class'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# This is a special case to handle the case where the object's metaclass |
28
|
|
|
|
|
|
|
# is a Class::MOP::Class, but _not_ a Moose::Meta::Class (for example, |
29
|
|
|
|
|
|
|
# when applying a role to a Moose::Meta::Attribute object). |
30
|
23
|
50
|
|
|
|
159
|
$obj_meta = 'Moose::Meta::Class' |
31
|
|
|
|
|
|
|
unless $obj_meta->isa('Moose::Meta::Class'); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $class = $obj_meta->create_anon_class( |
34
|
|
|
|
|
|
|
superclasses => [ blessed($object) ], |
35
|
|
|
|
|
|
|
roles => [ $role, keys(%$args) ? ($args) : () ], |
36
|
23
|
100
|
|
3
|
|
393
|
cache => (all { $_ eq '-alias' || $_ eq '-excludes' } keys %$args), |
|
3
|
100
|
|
|
|
29
|
|
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
23
|
|
|
|
|
136
|
$class->rebless_instance( $object, %{ $self->rebless_params } ); |
|
23
|
|
|
|
|
858
|
|
40
|
|
|
|
|
|
|
|
41
|
23
|
|
|
|
|
44
|
if ( _NEED_OVERLOAD_HACK_FOR_OBJECTS |
42
|
|
|
|
|
|
|
&& is_overloaded( ref $object ) ) { |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# need to use $_[2] here to apply to the object in the caller |
45
|
|
|
|
|
|
|
_reset_amagic($_[2]); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
23
|
|
|
|
|
98
|
return $object; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# ABSTRACT: Compose a role into an instance |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=encoding UTF-8 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Moose::Meta::Role::Application::ToInstance - Compose a role into an instance |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
version 2.2205 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DESCRIPTION |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 METHODS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=over 4 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item B<new> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item B<meta> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item B<apply> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item B<rebless_params> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 BUGS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
See L<Moose/BUGS> for details on reporting bugs. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 AUTHORS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=over 4 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Stevan Little <stevan@cpan.org> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Jesse Luehrs <doy@cpan.org> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Shawn M Moore <sartak@cpan.org> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item * |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Hans Dieter Pearcey <hdp@cpan.org> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item * |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Chris Prather <chris@prather.org> |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item * |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Matt S Trout <mstrout@cpan.org> |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=back |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This software is copyright (c) 2006 by Infinity Interactive, Inc. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
140
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |