remove 'u=' if 'o=' eq mycall
[spider.git] / perl / Bands.pm
index 7e67a60e3fb70e63ddc71b46e552e6a2e7f6ca50..728bb615538cdb7a6d8cdfbeac1bf74babf21c77 100644 (file)
@@ -11,7 +11,6 @@ package Bands;
 use DXUtil;
 use DXDebug;
 use DXVars;
-use Carp;
 
 use strict;
 use vars qw(%bands %regions %aliases $bandsfn %valid);
@@ -36,6 +35,12 @@ $bandsfn = "$main::data/bands.pl";
                  band => '0,BAND,parraypairs',
                 );
 
+use vars qw($VERSION $BRANCH);
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
 # load the band data
 sub load
 {
@@ -132,15 +137,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;