← Index
NYTProf Performance Profile   « block view • line view • sub view »
For ddd2.pl
  Run on Tue May 25 16:52:24 2010
Reported on Tue May 25 16:56:45 2010

File /project/perl/lib/Class/Accessor/Chained/Fast.pm
Statements Executed 25
Statement Execution Time 896µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
911202µs202µsClass::Accessor::Chained::Fast::::make_accessorClass::Accessor::Chained::Fast::make_accessor
0000s0sClass::Accessor::Chained::Fast::::BEGINClass::Accessor::Chained::Fast::BEGIN
0000s0sClass::Accessor::Chained::Fast::::__ANON__[:15]Class::Accessor::Chained::Fast::__ANON__[:15]
0000s0sClass::Accessor::Chained::Fast::::__ANON__[:34]Class::Accessor::Chained::Fast::__ANON__[:34]
0000s0sClass::Accessor::Chained::Fast::::make_wo_accessorClass::Accessor::Chained::Fast::make_wo_accessor
0000s0sbase::::BEGIN base::BEGIN
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
13121µs126µsuse strict;
# spent 26µs making 1 call to strict::import
2package Class::Accessor::Chained::Fast;
33529µs10suse base 'Class::Accessor::Fast';
# spent 262µs making 1 call to base::import, recursion: max depth 3, time 262µs
4
5
# spent 202µs within Class::Accessor::Chained::Fast::make_accessor which was called 9 times, avg 22µs/call: # 9 times (202µs+0s) by Class::Accessor::_mk_accessors at line 166 of Class/Accessor.pm, avg 22µs/call
sub make_accessor {
618234µs my($class, $field) = @_;
7
8 return sub {
9 my $self = shift;
10 if(@_) {
11 $self->{$field} = (@_ == 1 ? $_[0] : [@_]);
12 return $self;
13 }
14 return $self->{$field};
15 };
16}
17
18sub make_wo_accessor {
19 my($class, $field) = @_;
20
21 return sub {
22 my($self) = shift;
23
24 unless (@_) {
25 my $caller = caller;
26 require Carp;
27 Carp::croak("'$caller' cannot access the value of '$field' on ".
28 "objects of class '$class'");
29 }
30 else {
31 $self->{$field} = (@_ == 1 ? $_[0] : [@_]);
32 return $self;
33 }
34 };
35}
36
37112µs1;
38
39=head1 NAME
40
41Class::Accessor::Chained::Fast - Faster, but less expandable, chained accessors
42
43=head1 SYNOPSIS
44
45 package Foo;
46 use base qw(Class::Accessor::Chained::Fast);
47
48 # The rest as Class::Accessor::Chained except no set() or get().
49
50=head1 DESCRIPTION
51
52By analogue to Class::Accessor and Class::Accessor::Fast this module
53provides a faster less-flexible chained accessor maker.
54
55=head1 AUTHOR
56
57Richard Clamp <richardc@unixbeard.net>
58
59=head1 COPYRIGHT
60
61Copyright (C) 2003 Richard Clamp. All Rights Reserved.
62
63This module is free software; you can redistribute it and/or modify it
64under the same terms as Perl itself.
65
66=head1 SEE ALSO
67
68L<Class::Accessor::Fast>, L<Class::Accessor::Chained>
69
70=cut