Changeset 59 for trunk


Ignore:
Timestamp:
Jul 24, 2009, 2:23:15 AM (15 years ago)
Author:
g7moreau
Message:
  • Suppress parentheses on builtin function
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r58 r59  
    184184   $ret{timestamp}    = $timestamp if $timestamp;
    185185
    186    my $nowtimestamp = time();
     186   my $nowtimestamp = time;
    187187
    188188   if ( $type eq 'fast' and ( not defined $timestamp or $timestamp < ( $nowtimestamp - 3 * 3600 ) ) ) {
     
    220220      my @paquets = ();
    221221      foreach ( split m/ : /xms, $ret{mac_address} ) {
    222          my @chars = split m//xms, uc("00$_");
     222         my @chars = split m//xms, uc "00$_";
    223223         push @paquets, "$chars[-2]$chars[-1]";
    224224         }
     
    294294sub hex_to_dec {
    295295   #00:0F:1F:43:E4:2B
    296    my $car = '00' . uc(shift);
     296   my $car = '00' . uc shift;
    297297
    298298   return '00' if $car eq '00UNKNOW';
     
    351351         -varbindlist => [$research]
    352352         );
    353       if (not defined($result) or $result->{$research} eq 'noSuchInstance') {
     353      if (not defined $result or $result->{$research} eq 'noSuchInstance') {
    354354         $session->close;
    355355         next LOOP_ON_SWITCH;
     
    408408         );
    409409
    410       if(defined($result) and $result->{$research} ne 'noSuchInstance'){
     410      if(defined $result and $result->{$research} ne 'noSuchInstance'){
    411411         my $swport = $result->{$research};
    412412
     
    484484
    485485   my $reste = (($sw_port - 1) % 8) + 1;
    486    my $major = int( ($sw_port - 1) / 8 );
     486   my $major = int (($sw_port - 1) / 8);
    487487
    488488   return "$INTERNAL_PORT_MAP{$major}$reste";
     
    495495   return $sw_port if not $sw_model eq 'HP8000';
    496496
    497    my $letter = substr($sw_port, 0, 1);
     497   my $letter = substr $sw_port, 0, 1;
    498498
    499499#   return $port if $letter =~ m/\d/;
    500500
    501    my $reste =  substr($sw_port, 1);
     501   my $reste =  substr $sw_port, 1;
    502502
    503503   return $INTERNAL_PORT_MAP_REV{$letter} * 8 + $reste;
     
    569569      next LOOP_ON_COMPUTER unless exists $computerdb->{$ip};
    570570
    571       my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($computerdb->{$ip}{timestamp});
     571      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{timestamp};
    572572      $year += 1900;
    573573      $mon++;
     
    619619      if ( exists $db_switch_chained_port{$sw->{hostname}} ) {
    620620         chop $db_switch_chained_port{$sw->{hostname}};
    621          push @{$sw->{portignore}}, split(m/ : /xms, $db_switch_chained_port{$sw->{hostname}});
     621         push @{$sw->{portignore}}, split m/ : /xms, $db_switch_chained_port{$sw->{hostname}};
    622622         }
    623623#      print "$sw->{hostname} ++ @{$sw->{portignore}}\n";
     
    645645         $i++;
    646646
    647          my $total_percent = int(($i*100)/$number_of_computer);
     647         my $total_percent = int (($i*100)/$number_of_computer);
    648648
    649649         my $localtime = time - $timestamp;
    650          my ($sec,$min) = localtime($localtime);
     650         my ($sec,$min) = localtime $localtime;
    651651
    652652         my $time_elapse = 0;
    653653            $time_elapse = $localtime * ( 100 - $total_percent) / $total_percent if $total_percent != 0;
    654          my ($sec_elapse,$min_elapse) = localtime($time_elapse);
     654         my ($sec_elapse,$min_elapse) = localtime $time_elapse;
    655655
    656656         printf "\rComputer scanned: %4i/%i (%2i%%)",  $i,                 $number_of_computer, $total_percent;
     
    820820#      next if $computerdb->{$ip}{hostname_fq} eq 'unknow';
    821821
    822       my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($computerdb->{$ip}{timestamp});
     822      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{timestamp};
    823823      $year += 1900;
    824824      $mon++;
     
    890890      next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{hostname_fq} eq ($computerdb->{$ip}{switch_hostname} || $computerdb->{$ip}{switch_description}); # switch on himself !
    891891
    892       my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($computerdb->{$ip}{timestamp});
     892      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{timestamp};
    893893      $year += 1900;
    894894      $mon++;
     
    903903      my $switch_hostname_sort = sprintf '%s %3s' ,$switch_hostname, $computerdb->{$ip}{switch_port};
    904904
    905       my $ip_sort = sprintf '%03i%03i%03i%03i', split( m/ \. /xms, $ip);
     905      my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ \. /xms, $ip;
    906906
    907907      my $mac_sort = sprintf '%04i-%s', 9999 - $mac_count{$computerdb->{$ip}{mac_address}}, $computerdb->{$ip}{mac_address};
     
    947947      my $date = sprintf '%04i-%02i-%02i %02i:%02i', $year, $mon, $mday, $hour, $min;
    948948
    949       my $ip_sort = sprintf '%03i%03i%03i%03i', split( m/ \. /xms, $ipv4_address);
     949      my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ \. /xms, $ipv4_address;
    950950
    951951      my $mac_sort = sprintf '%04i-%s', 9999, $mac_address;
     
    995995      my $date = sprintf '%04i-%02i-%02i %02i:%02i', $year,$mon,$mday,$hour,$min;
    996996
    997       my $ip_sort = sprintf '%03i%03i%03i%03i', split( m/ \. /xms, $ipv4_address);
     997      my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ \. /xms, $ipv4_address;
    998998
    999999      my $mac_sort = sprintf '%04i-%s', 9999, $mac_address;
     
    11221122      );
    11231123
    1124    if (not defined($result) or $result->{$research} eq 'noSuchInstance') {
     1124   if (not defined $result or $result->{$research} eq 'noSuchInstance') {
    11251125      print "Klask do not find MAC $mac_address on switch $switch_name\n";
    11261126      $session->close;
Note: See TracChangeset for help on using the changeset viewer.