Changeset 60 for trunk


Ignore:
Timestamp:
Jul 25, 2009, 1:20:28 PM (15 years ago)
Author:
g7moreau
Message:
  • List declaration without trailing comma
  • Useless interpolation of literal string
  • Forbid $b before $a in sort blocks
  • File handle for "print" is not braced
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r59 r60  
    4242   $SWITCH_DB{$sw->{hostname}} = $sw;
    4343   }
    44 @SWITCH = sort { $switch_level{$b->{hostname}} <=> $switch_level{$a->{hostname}} } @{$KLASK_CFG->{switch}};
     44@SWITCH = reverse sort { $switch_level{$a->{hostname}} <=> $switch_level{$b->{hostname}} } @{$KLASK_CFG->{switch}};
    4545
    4646my %SWITCH_PORT_COUNT = ();
     
    111111   }
    112112else {
    113    print STDERR "klask: command $cmd not found\n\n";
     113   print {*STDERR} "klask: command $cmd not found\n\n";
    114114   $CMD_DB{help}->();
    115115   exit 1;
     
    176176   # my $cmd = "grep  -e '".'\b'."$param_ip_or_host".'\b'."' /var/lib/arpwatch/arp.dat | sort +2rn | head -1";
    177177   # my $cmd = "grep  -he '".'\b'."$param_ip_or_host".'\b'."' /var/lib/arpwatch/*.dat | sort +2rn | head -1";
    178    my $cmd = "grep  -he '" . '\b' . "$param_ip_or_host" . '\b' . "' /var/lib/arpwatch/$interface.dat | sort -rn -k 3,3 | head -1";
     178   my $cmd = q{grep  -he '\b} . $param_ip_or_host . q{\b' } . "/var/lib/arpwatch/$interface.dat | sort -rn -k 3,3 | head -1";
    179179   my $cmd_arpwatch = shell_command $cmd;
    180180   my ($arp, $ip, $timestamp, $host) = split m/ \s+ /xms, $cmd_arpwatch;
     
    300300      '0'=>'0',  '1'=>'1',  '2'=>'2',  '3'=>'3',  '4'=>'4',
    301301      '5'=>'5',  '6'=>'6',  '7'=>'7',  '8'=>'8',  '9'=>'9',
    302       'A'=>'10', 'B'=>'11', 'C'=>'12', 'D'=>'13', 'E'=>'14', 'F'=>'15'
     302      'A'=>'10', 'B'=>'11', 'C'=>'12', 'D'=>'13', 'E'=>'14', 'F'=>'15',
    303303      );
    304304   my @chars = split m//xms, $car;
     
    14141414
    14151415            my $swname  = $sw;
    1416                $swname .= '\n-\n'."$db_switch_global{$sw}->{model}" if exists $db_switch_global{$sw} and exists $db_switch_global{$sw}->{model};
     1416               $swname .= q{\n-\n} . "$db_switch_global{$sw}->{model}" if exists $db_switch_global{$sw} and exists $db_switch_global{$sw}->{model};
    14171417            print "\"$sw\" [label = \"$swname\", color = black, fillcolor = palegreen, shape = rect, style = filled];\n";
    14181418            print "\"location$b-$l\" -> \"$sw\" [len = 2, color = firebrick, arrowtail = dot]\n";
Note: See TracChangeset for help on using the changeset viewer.