Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Overload.pm |
Statements | Executed 16 statements in 274µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 8µs | 8µs | BEGIN@3 | Class::MOP::Method::Overload::
1 | 1 | 1 | 7µs | 11µs | BEGIN@10 | Class::MOP::Method::Overload::
1 | 1 | 1 | 7µs | 21µs | BEGIN@11 | Class::MOP::Method::Overload::
1 | 1 | 1 | 7µs | 42µs | BEGIN@13 | Class::MOP::Method::Overload::
1 | 1 | 1 | 6µs | 66µs | BEGIN@15 | Class::MOP::Method::Overload::
0 | 0 | 0 | 0s | 0s | _new | Class::MOP::Method::Overload::
0 | 0 | 0 | 0s | 0s | wrap | Class::MOP::Method::Overload::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | |||||
2 | package Class::MOP::Method::Overload; | ||||
3 | # spent 8µs within Class::MOP::Method::Overload::BEGIN@3 which was called:
# once (8µs+0s) by Class::MOP::Mixin::HasMethods::BEGIN@13 at line 5 | ||||
4 | 1 | 4µs | $Class::MOP::Method::Overload::AUTHORITY = 'cpan:STEVAN'; | ||
5 | 1 | 25µs | 1 | 8µs | } # spent 8µs making 1 call to Class::MOP::Method::Overload::BEGIN@3 |
6 | { | ||||
7 | 2 | 1µs | $Class::MOP::Method::Overload::VERSION = '2.0602'; | ||
8 | } | ||||
9 | |||||
10 | 3 | 17µs | 2 | 15µs | # spent 11µs (7+4) within Class::MOP::Method::Overload::BEGIN@10 which was called:
# once (7µs+4µs) by Class::MOP::Mixin::HasMethods::BEGIN@13 at line 10 # spent 11µs making 1 call to Class::MOP::Method::Overload::BEGIN@10
# spent 4µs making 1 call to strict::import |
11 | 3 | 19µs | 2 | 36µs | # spent 21µs (7+15) within Class::MOP::Method::Overload::BEGIN@11 which was called:
# once (7µs+15µs) by Class::MOP::Mixin::HasMethods::BEGIN@13 at line 11 # spent 21µs making 1 call to Class::MOP::Method::Overload::BEGIN@11
# spent 15µs making 1 call to warnings::import |
12 | |||||
13 | 3 | 27µs | 2 | 77µs | # spent 42µs (7+35) within Class::MOP::Method::Overload::BEGIN@13 which was called:
# once (7µs+35µs) by Class::MOP::Mixin::HasMethods::BEGIN@13 at line 13 # spent 42µs making 1 call to Class::MOP::Method::Overload::BEGIN@13
# spent 35µs making 1 call to Exporter::import |
14 | |||||
15 | 3 | 178µs | 2 | 125µs | # spent 66µs (6+59) within Class::MOP::Method::Overload::BEGIN@15 which was called:
# once (6µs+59µs) by Class::MOP::Mixin::HasMethods::BEGIN@13 at line 15 # spent 66µs making 1 call to Class::MOP::Method::Overload::BEGIN@15
# spent 59µs making 1 call to base::import |
16 | |||||
17 | sub wrap { | ||||
18 | my $class = shift; | ||||
19 | my (@args) = @_; | ||||
20 | unshift @args, 'body' if @args % 2 == 1; | ||||
21 | my %params = @args; | ||||
22 | |||||
23 | confess "operator is required" | ||||
24 | unless exists $params{operator}; | ||||
25 | |||||
26 | return $class->SUPER::wrap( | ||||
27 | name => "($params{operator}", | ||||
28 | %params, | ||||
29 | ); | ||||
30 | } | ||||
31 | |||||
32 | sub _new { | ||||
33 | my $class = shift; | ||||
34 | return Class::MOP::Class->initialize($class)->new_object(@_) | ||||
35 | if $class ne __PACKAGE__; | ||||
36 | |||||
37 | my $params = @_ == 1 ? $_[0] : {@_}; | ||||
38 | |||||
39 | return bless { | ||||
40 | # inherited from Class::MOP::Method | ||||
41 | 'body' => $params->{body}, | ||||
42 | 'associated_metaclass' => $params->{associated_metaclass}, | ||||
43 | 'package_name' => $params->{package_name}, | ||||
44 | 'name' => $params->{name}, | ||||
45 | 'original_method' => $params->{original_method}, | ||||
46 | |||||
47 | # defined in this class | ||||
48 | 'operator' => $params->{operator}, | ||||
49 | } => $class; | ||||
50 | } | ||||
51 | |||||
52 | 1 | 2µs | 1; | ||
53 | |||||
54 | # ABSTRACT: Method Meta Object for methods which implement overloading | ||||
55 | |||||
- - | |||||
58 | =pod | ||||
59 | |||||
60 | =head1 NAME | ||||
61 | |||||
62 | Class::MOP::Method::Overload - Method Meta Object for methods which implement overloading | ||||
63 | |||||
64 | =head1 VERSION | ||||
65 | |||||
66 | version 2.0602 | ||||
67 | |||||
68 | =head1 DESCRIPTION | ||||
69 | |||||
70 | This is a L<Class::MOP::Method> subclass which represents methods that | ||||
71 | implement overloading. | ||||
72 | |||||
73 | =head1 METHODS | ||||
74 | |||||
75 | =over 4 | ||||
76 | |||||
77 | =item B<< Class::MOP::Method::Overload->wrap($metamethod, %options) >> | ||||
78 | |||||
79 | This is the constructor. The options accepted are identical to the ones | ||||
80 | accepted by L<Class::MOP::Method>, except that it also required an C<operator> | ||||
81 | parameter, which should be an operator as defined by the L<overload> pragma. | ||||
82 | |||||
83 | =item B<< $metamethod->operator >> | ||||
84 | |||||
85 | This returns the operator that was passed to new. | ||||
86 | |||||
87 | =back | ||||
88 | |||||
89 | =head1 AUTHOR | ||||
90 | |||||
91 | Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details. | ||||
92 | |||||
93 | =head1 COPYRIGHT AND LICENSE | ||||
94 | |||||
95 | This software is copyright (c) 2012 by Infinity Interactive, Inc.. | ||||
96 | |||||
97 | This is free software; you can redistribute it and/or modify it under | ||||
98 | the same terms as the Perl 5 programming language system itself. | ||||
99 | |||||
100 | =cut | ||||
101 | |||||
102 | |||||
103 | __END__ |