Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
946 B

  1. #
  2. # $Id: MemberMixin.pm,v 1.5 1997/12/02 13:22:52 aas Exp $
  3. package LWP::MemberMixin;
  4. =head1 NAME
  5. LWP::MemberMixin - Member access mixin class
  6. =head1 SYNOPSIS
  7. package Foo;
  8. require LWP::MemberMixin;
  9. @ISA=qw(LWP::MemberMixin);
  10. =head1 DESCRIPTION
  11. A mixin class to get methods that provide easy access to member
  12. variables in the %$self.
  13. Ideally there should be better Perl langauge support for this.
  14. There is only one method provided:
  15. =over 4
  16. =item _elem($elem [, $val])
  17. Internal method to get/set the value of member variable
  18. C<$elem>. If C<$val> is defined it is used as the new value
  19. for the member variable. If it is undefined the current
  20. value is not touched. In both cases the previous value of
  21. the member variable is returned.
  22. =back
  23. =cut
  24. sub _elem
  25. {
  26. my($self, $elem, $val) = @_;
  27. my $old = $self->{$elem};
  28. $self->{$elem} = $val if defined $val;
  29. return $old;
  30. }
  31. 1;