X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRoute.pm;fp=perl%2FRoute.pm;h=cbc172dd93350215e625cfe680a6ad3e77e88c49;hb=42032b193f4411c08979c2cd8d1f39818d5de235;hp=47b87dac8a6fcfd8cf82af6f687a37f6036f566f;hpb=b1de8d406cf0b76292d401c4b75f33fca86a822d;p=spider.git diff --git a/perl/Route.pm b/perl/Route.pm index 47b87dac..cbc172dd 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -123,43 +123,50 @@ sub config my @out; my $line; my $call = $self->user_call; + my $printit = 1; - $line = ' ' x ($level*2) . "$call"; - $call = ' ' x length $call; - unless ($nodes_only) { - if (@{$self->{users}}) { - $line .= '->'; - foreach my $ucall (sort @{$self->{users}}) { - my $uref = Route::User::get($ucall); - my $c; - if ($uref) { - $c = $uref->user_call; - } else { - $c = "$ucall?"; - } - if ((length $line) + (length $c) + 1 < 79) { - $line .= $c . ' '; - } else { - $line =~ s/\s+$//; - push @out, $line; - $line = ' ' x ($level*2) . "$call->"; + # allow ranges + if (@_) { + $printit = grep $call =~ m|$_|, @_; + } + + if ($printit) { + $line = ' ' x ($level*2) . "$call"; + $call = ' ' x length $call; + unless ($nodes_only) { + if (@{$self->{users}}) { + $line .= '->'; + foreach my $ucall (sort @{$self->{users}}) { + my $uref = Route::User::get($ucall); + my $c; + if ($uref) { + $c = $uref->user_call; + } else { + $c = "$ucall?"; + } + if ((length $line) + (length $c) + 1 < 79) { + $line .= $c . ' '; + } else { + $line =~ s/\s+$//; + push @out, $line; + $line = ' ' x ($level*2) . "$call->"; + } } } } + $line =~ s/->$//g; + $line =~ s/\s+$//; + push @out, $line if length $line; } - $line =~ s/->$//g; - $line =~ s/\s+$//; - push @out, $line if length $line; foreach my $ncall (sort @{$self->{nodes}}) { my $nref = Route::Node::get($ncall); - next if @_ && !grep $ncall =~ m|$_|, @_; - + if ($nref) { my $c = $nref->user_call; push @out, $nref->config($nodes_only, $level+1, @_); } else { - push @out, ' ' x (($level+1)*2) . "$ncall?"; + push @out, ' ' x (($level+1)*2) . "$ncall?" if @_ == 0 || (@_ && grep $ncall =~ m|$_|, @_); } }