File | /project/perl/lib/LWP/MemberMixin.pm |
Statements Executed | 4611 |
Statement Execution Time | 30.6ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
922 | 2 | 1 | 28.5ms | 28.5ms | _elem | LWP::MemberMixin::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package LWP::MemberMixin; | ||||
2 | |||||
3 | # $Id: MemberMixin.pm,v 1.8 2004/04/09 15:07:04 gisle Exp $ | ||||
4 | |||||
5 | sub _elem | ||||
6 | # spent 28.5ms within LWP::MemberMixin::_elem which was called 922 times, avg 31µs/call:
# 461 times (15.4ms+0s) by LWP::UserAgent::protocols_allowed at line 520 of LWP/UserAgent.pm, avg 33µs/call
# 461 times (13.1ms+0s) by LWP::UserAgent::protocols_forbidden at line 521 of LWP/UserAgent.pm, avg 28µs/call | ||||
7 | 922 | 4.71ms | my $self = shift; | ||
8 | 922 | 4.70ms | my $elem = shift; | ||
9 | 922 | 4.84ms | my $old = $self->{$elem}; | ||
10 | 922 | 4.18ms | $self->{$elem} = shift if @_; | ||
11 | 922 | 12.2ms | return $old; | ||
12 | } | ||||
13 | |||||
14 | 1 | 12µs | 1; | ||
15 | |||||
16 | __END__ | ||||
17 | |||||
18 | =head1 NAME | ||||
19 | |||||
20 | LWP::MemberMixin - Member access mixin class | ||||
21 | |||||
22 | =head1 SYNOPSIS | ||||
23 | |||||
24 | package Foo; | ||||
25 | require LWP::MemberMixin; | ||||
26 | @ISA=qw(LWP::MemberMixin); | ||||
27 | |||||
28 | =head1 DESCRIPTION | ||||
29 | |||||
30 | A mixin class to get methods that provide easy access to member | ||||
31 | variables in the %$self. | ||||
32 | Ideally there should be better Perl language support for this. | ||||
33 | |||||
34 | There is only one method provided: | ||||
35 | |||||
36 | =over 4 | ||||
37 | |||||
38 | =item _elem($elem [, $val]) | ||||
39 | |||||
40 | Internal method to get/set the value of member variable | ||||
41 | C<$elem>. If C<$val> is present it is used as the new value | ||||
42 | for the member variable. If it is not present the current | ||||
43 | value is not touched. In both cases the previous value of | ||||
44 | the member variable is returned. | ||||
45 | |||||
46 | =back |