← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 01.HTTP.t
  Run on Tue May 4 15:25:55 2010
Reported on Tue May 4 15:26:05 2010

File /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Class/MOP/Module.pm
Statements Executed 36
Statement Execution Time 546µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
21136µs74µsClass::MOP::Module::::_instantiate_moduleClass::MOP::Module::_instantiate_module
11120µs55µsClass::MOP::Module::::BEGIN@7Class::MOP::Module::BEGIN@7
11120µs26µsClass::MOP::Module::::BEGIN@4Class::MOP::Module::BEGIN@4
11110µs30µsClass::MOP::Module::::BEGIN@5Class::MOP::Module::BEGIN@5
11110µs41µsClass::MOP::Module::::BEGIN@8Class::MOP::Module::BEGIN@8
1119µs2.12msClass::MOP::Module::::BEGIN@14Class::MOP::Module::BEGIN@14
1118µs21µsClass::MOP::Module::::BEGIN@64Class::MOP::Module::BEGIN@64
0000s0sClass::MOP::Module::::_newClass::MOP::Module::_new
0000s0sClass::MOP::Module::::authorityClass::MOP::Module::authority
0000s0sClass::MOP::Module::::createClass::MOP::Module::create
0000s0sClass::MOP::Module::::identifierClass::MOP::Module::identifier
0000s0sClass::MOP::Module::::versionClass::MOP::Module::version
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Class::MOP::Module;
3
4331µs233µs
# spent 26µs (20+6) within Class::MOP::Module::BEGIN@4 which was called # once (20µs+6µs) by base::import at line 4
use strict;
# spent 26µs making 1 call to Class::MOP::Module::BEGIN@4 # spent 7µs making 1 call to strict::import
5337µs249µs
# spent 30µs (10+20) within Class::MOP::Module::BEGIN@5 which was called # once (10µs+20µs) by base::import at line 5
use warnings;
# spent 30µs making 1 call to Class::MOP::Module::BEGIN@5 # spent 20µs making 1 call to warnings::import
6
7332µs289µs
# spent 55µs (20+34) within Class::MOP::Module::BEGIN@7 which was called # once (20µs+34µs) by base::import at line 7
use Carp 'confess';
# spent 55µs making 1 call to Class::MOP::Module::BEGIN@7 # spent 34µs making 1 call to Exporter::import
8372µs272µs
# spent 41µs (10+31) within Class::MOP::Module::BEGIN@8 which was called # once (10µs+31µs) by base::import at line 8
use Scalar::Util 'blessed';
# spent 41µs making 1 call to Class::MOP::Module::BEGIN@8 # spent 32µs making 1 call to Exporter::import
9
101800nsour $VERSION = '0.98';
11116µs$VERSION = eval $VERSION;
121400nsour $AUTHORITY = 'cpan:STEVAN';
13
143241µs22.12ms
# spent 2.12ms (9µs+2.11) within Class::MOP::Module::BEGIN@14 which was called # once (9µs+2.11ms) by base::import at line 14
use base 'Class::MOP::Package';
# spent 2.12ms making 1 call to Class::MOP::Module::BEGIN@14 # spent 2.11ms making 1 call to base::import, recursion: max depth 1, time 2.11ms
15
16sub _new {
17 my $class = shift;
18 return Class::MOP::Class->initialize($class)->new_object(@_)
19 if $class ne __PACKAGE__;
20
21 my $params = @_ == 1 ? $_[0] : {@_};
22 return bless {
23
24 # from Class::MOP::Package
25 package => $params->{package},
26 namespace => \undef,
27
28 # attributes
29 version => \undef,
30 authority => \undef
31 } => $class;
32}
33
34sub version {
35 my $self = shift;
36 ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'VERSION' })};
37}
38
39sub authority {
40 my $self = shift;
41 ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'AUTHORITY' })};
42}
43
44sub identifier {
45 my $self = shift;
46 join '-' => (
47 $self->name,
48 ($self->version || ()),
49 ($self->authority || ()),
50 );
51}
52
53sub create {
54 confess "The Class::MOP::Module->create method has been made a private object method.\n";
55}
56
57
# spent 74µs (36+38) within Class::MOP::Module::_instantiate_module which was called 2 times, avg 37µs/call: # 2 times (36µs+38µs) by Class::MOP::Class::create at line 300 of Class/MOP/Class.pm, avg 37µs/call
sub _instantiate_module {
581436µs my($self, $version, $authority) = @_;
59 my $package_name = $self->name;
# spent 800ns making 2 calls to Class::MOP::Package::name, avg 400ns/call
60
61 Class::MOP::_is_valid_class_name($package_name)
# spent 37µs making 2 calls to Class::MOP::_is_valid_class_name, avg 18µs/call
62 || confess "creation of $package_name failed: invalid package name";
63
64376µs234µs
# spent 21µs (8+13) within Class::MOP::Module::BEGIN@64 which was called # once (8µs+13µs) by base::import at line 64
no strict 'refs';
# spent 21µs making 1 call to Class::MOP::Module::BEGIN@64 # spent 13µs making 1 call to strict::unimport
65 scalar %{ $package_name . '::' }; # touch the stash
66 ${ $package_name . '::VERSION' } = $version if defined $version;
67 ${ $package_name . '::AUTHORITY' } = $authority if defined $authority;
68
69 return;
70}
71
7215µs1;
73
74__END__
75
76=pod
77
78=head1 NAME
79
80Class::MOP::Module - Module Meta Object
81
82=head1 DESCRIPTION
83
84A module is essentially a L<Class::MOP::Package> with metadata, in our
85case the version and authority.
86
87=head1 INHERITANCE
88
89B<Class::MOP::Module> is a subclass of L<Class::MOP::Package>.
90
91=head1 METHODS
92
93=over 4
94
95=item B<< $metamodule->version >>
96
97This is a read-only attribute which returns the C<$VERSION> of the
98package, if one exists.
99
100=item B<< $metamodule->authority >>
101
102This is a read-only attribute which returns the C<$AUTHORITY> of the
103package, if one exists.
104
105=item B<< $metamodule->identifier >>
106
107This constructs a string which combines the name, version and
108authority.
109
110=item B<< Class::MOP::Module->meta >>
111
112This will return a L<Class::MOP::Class> instance for this class.
113
114=back
115
116=head1 AUTHORS
117
118Stevan Little E<lt>stevan@iinteractive.comE<gt>
119
120=head1 COPYRIGHT AND LICENSE
121
122Copyright 2006-2010 by Infinity Interactive, Inc.
123
124L<http://www.iinteractive.com>
125
126This library is free software; you can redistribute it and/or modify
127it under the same terms as Perl itself.
128
129=cut