X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FBands.pm;h=65849c9a5d0c3e732420e44eb175f7951930625b;hb=74803d3f4937220f536cd67b515faa15da6e0520;hp=16a992ed603c77c9da3218a07f49661badeec13a;hpb=0bd9d2811cc42417676a1b11b121681c2377d70a;p=spider.git diff --git a/perl/Bands.pm b/perl/Bands.pm index 16a992ed..65849c9a 100644 --- a/perl/Bands.pm +++ b/perl/Bands.pm @@ -35,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 { @@ -131,15 +137,21 @@ sub field_prompt return $valid{$ele}; } -no strict; +#no strict; sub AUTOLOAD { + no strict; my $self = shift; 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}}; + &$AUTOLOAD($self, @_); +# *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ; +# @_ ? $self->{$name} = shift : $self->{$name} ; } 1;