← Index
NYTProf Performance Profile   « line view »
For /usr/local/libexec/sympa/task_manager-debug.pl
  Run on Tue Jun 1 22:32:51 2021
Reported on Tue Jun 1 22:35:06 2021

Filename/usr/local/lib/perl5/site_perl/Class/Data/Inheritable.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sClass::Data::Inheritable::::BEGIN@3Class::Data::Inheritable::BEGIN@3
0000s0sClass::Data::Inheritable::::BEGIN@4Class::Data::Inheritable::BEGIN@4
0000s0sClass::Data::Inheritable::::__ANON__[:23]Class::Data::Inheritable::__ANON__[:23]
0000s0sClass::Data::Inheritable::::mk_classdataClass::Data::Inheritable::mk_classdata
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Class::Data::Inheritable;
2
3use strict qw(vars subs);
4use vars qw($VERSION);
5$VERSION = '0.08';
6
7sub mk_classdata {
8 my ($declaredclass, $attribute, $data) = @_;
9
10 if( ref $declaredclass ) {
11 require Carp;
12 Carp::croak("mk_classdata() is a class method, not an object method");
13 }
14
15 my $accessor = sub {
16 my $wantclass = ref($_[0]) || $_[0];
17
18 return $wantclass->mk_classdata($attribute)->(@_)
19 if @_>1 && $wantclass ne $declaredclass;
20
21 $data = $_[1] if @_>1;
22 return $data;
23 };
24
25 my $alias = "_${attribute}_accessor";
26 *{$declaredclass.'::'.$attribute} = $accessor;
27 *{$declaredclass.'::'.$alias} = $accessor;
28}
29
301;
31
32__END__