Prepare for git repository
[spider.git] / perl / Bands.pm
index 16a992ed603c77c9da3218a07f49661badeec13a..7563e9274f713f64ae93dc3284a61ed1b125f425 100644 (file)
@@ -131,15 +131,18 @@ sub field_prompt
        return $valid{$ele};
 }
 
-no strict;
+#no strict;
 sub AUTOLOAD
 {
-       my $self = shift;
+       no strict;
        my $name = $AUTOLOAD;
        return if $name =~ /::DESTROY$/;
-       $name =~ s/.*:://o;
+       $name =~ s/^.*:://o;
   
-       @_ ? $self->{$name} = shift : $self->{$name} ;
+       # 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}};
+       goto &$AUTOLOAD;
 }
 
 1;