source:
main/trunk/greenstone2/perllib/cpan/LWP/MemberMixin.pm@
27174
Last change on this file since 27174 was 27174, checked in by , 11 years ago | |
---|---|
File size: 846 bytes |
Line | |
---|---|
1 | package LWP::MemberMixin; |
2 | |
3 | sub _elem |
4 | { |
5 | my $self = shift; |
6 | my $elem = shift; |
7 | my $old = $self->{$elem}; |
8 | $self->{$elem} = shift if @_; |
9 | return $old; |
10 | } |
11 | |
12 | 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 |
Note:
See TracBrowser
for help on using the repository browser.