All pastes #217768 Raw Edit

Untitled

public text v1 · immutable
#217768 ·published 2006-10-23 20:39 UTC
rendered paste body
AUTOLOAD { # magic..
  use vars; 
  no strict 'refs';
  our $AUTOLOAD;
  local $key = $AUTOLOAD; 
  $key =~ s/.*:://;
  croak "No such entry $key"
   unless exists $Defaults->{$key};
  *$AUTOLOAD = sub {
    my $self = shift; 
    $self->{$key} = shift # $key is not defined at the time this sub is being called, only when its defined
      if @_;
    $self->{$key}
  };
  goto &$AUTOLOAD; 
}