line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Meta::Role::Application::ToInstance; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2203'; |
3
|
|
|
|
|
|
|
|
4
|
388
|
|
|
388
|
|
2640
|
use strict; |
|
388
|
|
|
|
|
883
|
|
|
388
|
|
|
|
|
11839
|
|
5
|
388
|
|
|
388
|
|
2045
|
use warnings; |
|
388
|
|
|
|
|
842
|
|
|
388
|
|
|
|
|
9213
|
|
6
|
388
|
|
|
388
|
|
1869
|
use metaclass; |
|
388
|
|
|
|
|
875
|
|
|
388
|
|
|
|
|
2007
|
|
7
|
|
|
|
|
|
|
|
8
|
388
|
|
|
388
|
|
2799
|
use Scalar::Util 'blessed'; |
|
388
|
|
|
|
|
991
|
|
|
388
|
|
|
|
|
21531
|
|
9
|
388
|
|
|
388
|
|
2531
|
use List::Util 1.33 'all'; |
|
388
|
|
|
|
|
7034
|
|
|
388
|
|
|
|
|
24752
|
|
10
|
388
|
|
|
388
|
|
2891
|
use Devel::OverloadInfo 0.004 'is_overloaded'; |
|
388
|
|
|
|
|
6733
|
|
|
388
|
|
|
|
|
18212
|
|
11
|
|
|
|
|
|
|
|
12
|
388
|
|
|
388
|
|
2474
|
use parent 'Moose::Meta::Role::Application'; |
|
388
|
|
|
|
|
1066
|
|
|
388
|
|
|
|
|
2399
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
__PACKAGE__->meta->add_attribute('rebless_params' => ( |
15
|
|
|
|
|
|
|
reader => 'rebless_params', |
16
|
|
|
|
|
|
|
default => sub { {} }, |
17
|
|
|
|
|
|
|
Class::MOP::_definition_context(), |
18
|
|
|
|
|
|
|
)); |
19
|
|
|
|
|
|
|
|
20
|
388
|
|
|
388
|
|
47245
|
use constant _NEED_OVERLOAD_HACK_FOR_OBJECTS => "$]" < 5.008009; |
|
388
|
|
|
|
|
1015
|
|
|
388
|
|
|
|
|
103570
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub apply { |
23
|
23
|
|
|
23
|
1
|
104
|
my ( $self, $role, $object, $args ) = @_; |
24
|
|
|
|
|
|
|
|
25
|
23
|
|
100
|
|
|
82
|
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
|
|
|
|
134
|
$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
|
|
355
|
cache => (all { $_ eq '-alias' || $_ eq '-excludes' } keys %$args), |
|
3
|
100
|
|
|
|
24
|
|
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
23
|
|
|
|
|
112
|
$class->rebless_instance( $object, %{ $self->rebless_params } ); |
|
23
|
|
|
|
|
866
|
|
40
|
|
|
|
|
|
|
|
41
|
23
|
|
|
|
|
48
|
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
|
|
|
|
|
86
|
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.2203 |
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 |