| File | /usr/local/lib/perl5/site_perl/5.10.1/LWP/MemberMixin.pm |
| Statements Executed | 31 |
| Statement Execution Time | 31µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 6 | 2 | 1 | 22µs | 22µs | LWP::MemberMixin::_elem |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package LWP::MemberMixin; | ||||
| 2 | |||||
| 3 | sub _elem | ||||
| 4 | # spent 22µs within LWP::MemberMixin::_elem which was called 6 times, avg 4µs/call:
# 3 times (14µs+0s) by LWP::UserAgent::protocols_allowed at line 524 of LWP/UserAgent.pm, avg 5µs/call
# 3 times (7µs+0s) by LWP::UserAgent::protocols_forbidden at line 525 of LWP/UserAgent.pm, avg 2µs/call | ||||
| 5 | 6 | 3µs | my $self = shift; | ||
| 6 | 6 | 3µs | my $elem = shift; | ||
| 7 | 6 | 3µs | my $old = $self->{$elem}; | ||
| 8 | 6 | 1µs | $self->{$elem} = shift if @_; | ||
| 9 | 6 | 18µs | return $old; | ||
| 10 | } | ||||
| 11 | |||||
| 12 | 1 | 3µ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 |