← Index
NYTProf Performance Profile   « line view »
For fastest.pl
  Run on Fri Jan 31 20:48:16 2014
Reported on Fri Jan 31 20:49:41 2014

Filename/opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Object.pm
StatementsExecuted 26 statements in 1.45ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111273µs304µsMoose::Object::::BEGIN@19Moose::Object::BEGIN@19
11174µs76µsMoose::Object::::BEGIN@108Moose::Object::BEGIN@108
11117µs2.48msMoose::Object::::BEGIN@20Moose::Object::BEGIN@20
11115µs15µsMoose::Object::::BEGIN@3Moose::Object::BEGIN@3
11110µs25µsMoose::Object::::BEGIN@85Moose::Object::BEGIN@85
1119µs13µsMoose::Object::::BEGIN@11Moose::Object::BEGIN@11
1118µs24µsMoose::Object::::BEGIN@10Moose::Object::BEGIN@10
1114µs4µsMoose::Object::::BEGIN@16Moose::Object::BEGIN@16
1114µs4µsMoose::Object::::BEGIN@13Moose::Object::BEGIN@13
1114µs4µsMoose::Object::::BEGIN@14Moose::Object::BEGIN@14
1113µs3µsMoose::Object::::BEGIN@15Moose::Object::BEGIN@15
1113µs3µsMoose::Object::::BEGIN@17Moose::Object::BEGIN@17
0000s0sMoose::Object::::BUILDALLMoose::Object::BUILDALL
0000s0sMoose::Object::::BUILDARGSMoose::Object::BUILDARGS
0000s0sMoose::Object::::DEMOLISHALLMoose::Object::DEMOLISHALL
0000s0sMoose::Object::::DESTROYMoose::Object::DESTROY
0000s0sMoose::Object::::__ANON__[:102]Moose::Object::__ANON__[:102]
0000s0sMoose::Object::::__ANON__[:99]Moose::Object::__ANON__[:99]
0000s0sMoose::Object::::doesMoose::Object::does
0000s0sMoose::Object::::dumpMoose::Object::dump
0000s0sMoose::Object::::newMoose::Object::new
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Moose::Object;
3
# spent 15µs within Moose::Object::BEGIN@3 which was called: # once (15µs+0s) by Moose::BEGIN@33 at line 5
BEGIN {
417µs $Moose::Object::AUTHORITY = 'cpan:STEVAN';
5141µs115µs}
# spent 15µs making 1 call to Moose::Object::BEGIN@3
6{
721µs $Moose::Object::VERSION = '2.1005';
8}
9
10229µs240µs
# spent 24µs (8+16) within Moose::Object::BEGIN@10 which was called: # once (8µs+16µs) by Moose::BEGIN@33 at line 10
use strict;
# spent 24µs making 1 call to Moose::Object::BEGIN@10 # spent 16µs making 1 call to strict::import
11231µs218µs
# spent 13µs (9+5) within Moose::Object::BEGIN@11 which was called: # once (9µs+5µs) by Moose::BEGIN@33 at line 11
use warnings;
# spent 13µs making 1 call to Moose::Object::BEGIN@11 # spent 5µs making 1 call to warnings::import
12
13224µs14µs
# spent 4µs within Moose::Object::BEGIN@13 which was called: # once (4µs+0s) by Moose::BEGIN@33 at line 13
use Carp ();
# spent 4µs making 1 call to Moose::Object::BEGIN@13
14222µs14µs
# spent 4µs within Moose::Object::BEGIN@14 which was called: # once (4µs+0s) by Moose::BEGIN@33 at line 14
use Devel::GlobalDestruction ();
# spent 4µs making 1 call to Moose::Object::BEGIN@14
15229µs13µs
# spent 3µs within Moose::Object::BEGIN@15 which was called: # once (3µs+0s) by Moose::BEGIN@33 at line 15
use MRO::Compat ();
# spent 3µs making 1 call to Moose::Object::BEGIN@15
16225µs14µs
# spent 4µs within Moose::Object::BEGIN@16 which was called: # once (4µs+0s) by Moose::BEGIN@33 at line 16
use Scalar::Util ();
# spent 4µs making 1 call to Moose::Object::BEGIN@16
17241µs13µs
# spent 3µs within Moose::Object::BEGIN@17 which was called: # once (3µs+0s) by Moose::BEGIN@33 at line 17
use Try::Tiny ();
# spent 3µs making 1 call to Moose::Object::BEGIN@17
18
192301µs2308µs
# spent 304µs (273+31) within Moose::Object::BEGIN@19 which was called: # once (273µs+31µs) by Moose::BEGIN@33 at line 19
use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class';
# spent 304µs making 1 call to Moose::Object::BEGIN@19 # spent 4µs making 1 call to if::import
202420µs22.48ms
# spent 2.48ms (17µs+2.46) within Moose::Object::BEGIN@20 which was called: # once (17µs+2.46ms) by Moose::BEGIN@33 at line 20
use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class';
# spent 2.48ms making 1 call to Moose::Object::BEGIN@20 # spent 3µs making 1 call to if::import
21
22sub new {
23 my $class = shift;
24 my $real_class = Scalar::Util::blessed($class) || $class;
25
26 my $params = $real_class->BUILDARGS(@_);
27
28 return Class::MOP::Class->initialize($real_class)->new_object($params);
29}
30
31sub BUILDARGS {
32 my $class = shift;
33 if ( scalar @_ == 1 ) {
34 unless ( defined $_[0] && ref $_[0] eq 'HASH' ) {
35 Class::MOP::class_of($class)->throw_error(
36 "Single parameters to new() must be a HASH ref",
37 data => $_[0] );
38 }
39 return { %{ $_[0] } };
40 }
41 elsif ( @_ % 2 ) {
42 Carp::carp(
43 "The new() method for $class expects a hash reference or a key/value list."
44 . " You passed an odd number of arguments" );
45 return { @_, undef };
46 }
47 else {
48 return {@_};
49 }
50}
51
52sub BUILDALL {
53 # NOTE: we ask Perl if we even
54 # need to do this first, to avoid
55 # extra meta level calls
56 return unless $_[0]->can('BUILD');
57 my ($self, $params) = @_;
58 foreach my $method (reverse Class::MOP::class_of($self)->find_all_methods_by_name('BUILD')) {
59 $method->{code}->execute($self, $params);
60 }
61}
62
63sub DEMOLISHALL {
64 my $self = shift;
65 my ($in_global_destruction) = @_;
66
67 # NOTE: we ask Perl if we even
68 # need to do this first, to avoid
69 # extra meta level calls
70 return unless $self->can('DEMOLISH');
71
72 my @isa;
73 if ( my $meta = Class::MOP::class_of($self ) ) {
74 @isa = $meta->linearized_isa;
75 } else {
76 # We cannot count on being able to retrieve a previously made
77 # metaclass, _or_ being able to make a new one during global
78 # destruction. However, we should still be able to use mro at
79 # that time (at least tests suggest so ;)
80 my $class_name = ref $self;
81 @isa = @{ mro::get_linear_isa($class_name) }
82 }
83
84 foreach my $class (@isa) {
852228µs241µs
# spent 25µs (10+16) within Moose::Object::BEGIN@85 which was called: # once (10µs+16µs) by Moose::BEGIN@33 at line 85
no strict 'refs';
# spent 25µs making 1 call to Moose::Object::BEGIN@85 # spent 16µs making 1 call to strict::unimport
86 my $demolish = *{"${class}::DEMOLISH"}{CODE};
87 $self->$demolish($in_global_destruction)
88 if defined $demolish;
89 }
90}
91
92sub DESTROY {
93 my $self = shift;
94
95 local $?;
96
97 Try::Tiny::try {
98 $self->DEMOLISHALL(Devel::GlobalDestruction::in_global_destruction);
99 }
100 Try::Tiny::catch {
101 die $_;
102 };
103
104 return;
105}
106
107# support for UNIVERSAL::DOES ...
108
# spent 76µs (74+2) within Moose::Object::BEGIN@108 which was called: # once (74µs+2µs) by Moose::BEGIN@33 at line 115
BEGIN {
10919µs12µs my $does = UNIVERSAL->can("DOES") ? "SUPER::DOES" : "isa";
# spent 2µs making 1 call to UNIVERSAL::can
110168µs eval 'sub DOES {
# spent 0s executing statements in string eval
111 my ( $self, $class_or_role_name ) = @_;
112 return $self->'.$does.'($class_or_role_name)
113 || $self->does($class_or_role_name);
114 }';
1151167µs176µs}
# spent 76µs making 1 call to Moose::Object::BEGIN@108
116
117# new does() methods will be created
118# as appropriate see Moose::Meta::Role
119sub does {
120 my ($self, $role_name) = @_;
121 my $class = Scalar::Util::blessed($self) || $self;
122 my $meta = Class::MOP::Class->initialize($class);
123 (defined $role_name)
124 || $meta->throw_error("You must supply a role name to does()");
125 return 1 if $meta->can('does_role') && $meta->does_role($role_name);
126 return 0;
127}
128
129sub dump {
130 my $self = shift;
131 require Data::Dumper;
132 local $Data::Dumper::Maxdepth = shift if @_;
133 Data::Dumper::Dumper $self;
134}
135
13614µs1;
137
138# ABSTRACT: The base object for Moose
139
140__END__