1. Added an efficiency thing for AUTOLOADed accessors from OO Perl by Conway.
[spider.git] / perl / Bands.pm
index 16a992ed603c77c9da3218a07f49661badeec13a..d40d4c823d1dfe032579a39b7009dbb4dc86b2f8 100644 (file)
@@ -139,6 +139,9 @@ sub AUTOLOAD
        return if $name =~ /::DESTROY$/;
        $name =~ s/.*:://o;
   
+       # this clever line of code creates a subroutine which takes over from autoload
+       # from OO Perl - Conway
+       *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ;
        @_ ? $self->{$name} = shift : $self->{$name} ;
 }