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