← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 10:04:38 2014
Reported on Tue Jun 24 10:05:07 2014

Filename/usr/local/lib/perl/5.14.2/Moose/Meta/Role/Attribute.pm
StatementsExecuted 21 statements in 687µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1119µs9µsMoose::Meta::Role::Attribute::::BEGIN@2Moose::Meta::Role::Attribute::BEGIN@2
1118µs28µsMoose::Meta::Role::Attribute::::BEGIN@13Moose::Meta::Role::Attribute::BEGIN@13
1118µs11µsMoose::Meta::Role::Attribute::::BEGIN@9Moose::Meta::Role::Attribute::BEGIN@9
1117µs16µsMoose::Meta::Role::Attribute::::BEGIN@10Moose::Meta::Role::Attribute::BEGIN@10
1117µs31µsMoose::Meta::Role::Attribute::::BEGIN@12Moose::Meta::Role::Attribute::BEGIN@12
1117µs78µsMoose::Meta::Role::Attribute::::BEGIN@16Moose::Meta::Role::Attribute::BEGIN@16
1116µs31µsMoose::Meta::Role::Attribute::::BEGIN@14Moose::Meta::Role::Attribute::BEGIN@14
0000s0sMoose::Meta::Role::Attribute::::__ANON__[:120]Moose::Meta::Role::Attribute::__ANON__[:120]
0000s0sMoose::Meta::Role::Attribute::::attach_to_roleMoose::Meta::Role::Attribute::attach_to_role
0000s0sMoose::Meta::Role::Attribute::::attribute_for_classMoose::Meta::Role::Attribute::attribute_for_class
0000s0sMoose::Meta::Role::Attribute::::cloneMoose::Meta::Role::Attribute::clone
0000s0sMoose::Meta::Role::Attribute::::is_same_asMoose::Meta::Role::Attribute::is_same_as
0000s0sMoose::Meta::Role::Attribute::::newMoose::Meta::Role::Attribute::new
0000s0sMoose::Meta::Role::Attribute::::original_roleMoose::Meta::Role::Attribute::original_role
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Meta::Role::Attribute;
2
# spent 9µs within Moose::Meta::Role::Attribute::BEGIN@2 which was called: # once (9µs+0s) by Moose::Meta::Role::BEGIN@19 at line 4
BEGIN {
315µs $Moose::Meta::Role::Attribute::AUTHORITY = 'cpan:STEVAN';
4134µs19µs}
# spent 9µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@2
5{
621µs $Moose::Meta::Role::Attribute::VERSION = '2.1005';
7}
8
9222µs214µs
# spent 11µs (8+3) within Moose::Meta::Role::Attribute::BEGIN@9 which was called: # once (8µs+3µs) by Moose::Meta::Role::BEGIN@19 at line 9
use strict;
# spent 11µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@9 # spent 3µs making 1 call to strict::import
10223µs224µs
# spent 16µs (7+8) within Moose::Meta::Role::Attribute::BEGIN@10 which was called: # once (7µs+8µs) by Moose::Meta::Role::BEGIN@19 at line 10
use warnings;
# spent 16µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@10 # spent 8µs making 1 call to warnings::import
11
12225µs255µs
# spent 31µs (7+24) within Moose::Meta::Role::Attribute::BEGIN@12 which was called: # once (7µs+24µs) by Moose::Meta::Role::BEGIN@19 at line 12
use Carp 'confess';
# spent 31µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@12 # spent 24µs making 1 call to Exporter::import
13224µs248µs
# spent 28µs (8+20) within Moose::Meta::Role::Attribute::BEGIN@13 which was called: # once (8µs+20µs) by Moose::Meta::Role::BEGIN@19 at line 13
use List::MoreUtils 'all';
# spent 28µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@13 # spent 20µs making 1 call to Exporter::import
14230µs256µs
# spent 31µs (6+25) within Moose::Meta::Role::Attribute::BEGIN@14 which was called: # once (6µs+25µs) by Moose::Meta::Role::BEGIN@19 at line 14
use Scalar::Util 'blessed', 'weaken';
# spent 31µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@14 # spent 25µs making 1 call to Exporter::import
15
162492µs2150µs
# spent 78µs (7+72) within Moose::Meta::Role::Attribute::BEGIN@16 which was called: # once (7µs+72µs) by Moose::Meta::Role::BEGIN@19 at line 16
use base 'Moose::Meta::Mixin::AttributeCore', 'Class::MOP::Object';
# spent 78µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@16 # spent 72µs making 1 call to base::import
17
1819µs3756µs__PACKAGE__->meta->add_attribute(
# spent 438µs making 1 call to Class::MOP::Mixin::meta # spent 313µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 6µs making 1 call to Class::MOP::_definition_context
19 'metaclass' => (
20 reader => 'metaclass',
21 Class::MOP::_definition_context(),
22 )
23);
24
2514µs3317µs__PACKAGE__->meta->add_attribute(
# spent 300µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 12µs making 1 call to Class::MOP::Mixin::meta # spent 5µs making 1 call to Class::MOP::_definition_context
26 'associated_role' => (
27 reader => 'associated_role',
28 Class::MOP::_definition_context(),
29 )
30);
31
3213µs3310µs__PACKAGE__->meta->add_attribute(
# spent 294µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 11µs making 1 call to Class::MOP::Mixin::meta # spent 5µs making 1 call to Class::MOP::_definition_context
33 '_original_role' => (
34 reader => '_original_role',
35 Class::MOP::_definition_context(),
36 )
37);
38
3913µs3318µs__PACKAGE__->meta->add_attribute(
# spent 297µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 11µs making 1 call to Class::MOP::Mixin::meta # spent 9µs making 1 call to Class::MOP::_definition_context
40 'is' => (
41 reader => 'is',
42 Class::MOP::_definition_context(),
43 )
44);
45
4613µs3311µs__PACKAGE__->meta->add_attribute(
# spent 295µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 11µs making 1 call to Class::MOP::Mixin::meta # spent 5µs making 1 call to Class::MOP::_definition_context
47 'original_options' => (
48 reader => 'original_options',
49 Class::MOP::_definition_context(),
50 )
51);
52
53sub new {
54 my ( $class, $name, %options ) = @_;
55
56 (defined $name)
57 || confess "You must provide a name for the attribute";
58
59 my $role = delete $options{_original_role};
60
61 return bless {
62 name => $name,
63 original_options => \%options,
64 _original_role => $role,
65 %options,
66 }, $class;
67}
68
69sub attach_to_role {
70 my ( $self, $role ) = @_;
71
72 ( blessed($role) && $role->isa('Moose::Meta::Role') )
73 || confess
74 "You must pass a Moose::Meta::Role instance (or a subclass)";
75
76 weaken( $self->{'associated_role'} = $role );
77}
78
79sub original_role {
80 my $self = shift;
81
82 return $self->_original_role || $self->associated_role;
83}
84
85sub attribute_for_class {
86 my $self = shift;
87
88 my $metaclass = $self->original_role->applied_attribute_metaclass;
89
90 return $metaclass->interpolate_class_and_new(
91 $self->name => %{ $self->original_options } );
92}
93
94sub clone {
95 my $self = shift;
96
97 my $role = $self->original_role;
98
99 return ( ref $self )->new(
100 $self->name,
101 %{ $self->original_options },
102 _original_role => $role,
103 );
104}
105
106sub is_same_as {
107 my $self = shift;
108 my $attr = shift;
109
110 my $self_options = $self->original_options;
111 my $other_options = $attr->original_options;
112
113 return 0
114 unless ( join q{|}, sort keys %{$self_options} ) eq ( join q{|}, sort keys %{$other_options} );
115
116 for my $key ( keys %{$self_options} ) {
117 return 0 if defined $self_options->{$key} && ! defined $other_options->{$key};
118 return 0 if ! defined $self_options->{$key} && defined $other_options->{$key};
119
120 next if all { ! defined } $self_options->{$key}, $other_options->{$key};
121
122 return 0 unless $self_options->{$key} eq $other_options->{$key};
123 }
124
125 return 1;
126}
127
12819µs1;
129
130# ABSTRACT: The Moose attribute metaclass for Roles
131
132__END__