X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRoute.pm;h=7276c6979fc7f08510cb1d2df8328dae7a470996;hb=3634fba90a64fe488d237f438d9945d81158da52;hp=61d07249917a889028eba36f8f9c694e8ad9a0ab;hpb=6624dcdf07d628e8d6a16fc6549edf40be25b7b2;p=spider.git diff --git a/perl/Route.pm b/perl/Route.pm index 61d07249..7276c697 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -20,6 +20,13 @@ use Prefix; use strict; + +use vars qw($VERSION $BRANCH); +$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); +$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0; +$main::build += $VERSION; +$main::branch += $BRANCH; + use vars qw(%list %valid $filterdef); %valid = ( @@ -85,28 +92,41 @@ sub _addlist { my $self = shift; my $field = shift; + my @out; foreach my $c (@_) { - my $call = _getcall($c); - unless (grep {$_ eq $call} @{$self->{$field}}) { + confess "Need a ref here" unless ref($c); + + my $call = $c->{call}; + unless (grep $_ eq $call, @{$self->{$field}}) { push @{$self->{$field}}, $call; dbg(ref($self) . " adding $call to " . $self->{call} . "->\{$field\}") if isdbg('routelow'); + push @out, $c; } } - return $self->{$field}; + return @out; } sub _dellist { my $self = shift; my $field = shift; + my @out; foreach my $c (@_) { - my $call = _getcall($c); - if (grep {$_ eq $call} @{$self->{$field}}) { + confess "Need a ref here" unless ref($c); + my $call = $c->{call}; + if (grep $_ eq $call, @{$self->{$field}}) { $self->{$field} = [ grep {$_ ne $call} @{$self->{$field}} ]; dbg(ref($self) . " deleting $call from " . $self->{call} . "->\{$field\}") if isdbg('routelow'); + push @out, $c; } } - return $self->{$field}; + return @out; +} + +sub is_empty +{ + my $self = shift; + return @{$self->{$_[0]}} == 0; } #