[Memphis.pm] AUTOLOAD function

Big Ed dysan_2000 at hotmail.com
Mon Mar 20 13:35:35 CST 2000


I knew I was forgetting something for you, Brock.  Here's a basic AUTOLOAD 
function:

sub AUTOLOAD {
  my $self = shift;

  (my $a = $AUTOLOAD) =~ s/.*:://g;
  @_ ? $self->{$a} = shift
    : return $self->{$a};
  }
}

This is called when you do something like:

$object->a()

It will give you the value of 'a'.

$object->a('Foo')

will set the value of 'a' to 'Foo'.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

----------------------------------------------------------------------------
To unsubscribe, please send email to majordomo at pm.org
with 'unsubscribe memphis-pm-list' in the body of the message.
----------------------------------------------------------------------------




More information about the Memphis-pm mailing list