Changeset 53 for trunk


Ignore:
Timestamp:
Jul 24, 2009, 1:01:13 AM (15 years ago)
Author:
g7moreau
Message:
  • Suppress perlcritic warning level 2 String delimiter used with "split" at line XXX, column XX. Express it as a regex instead.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r52 r53  
    282282
    283283      # Ligne à virer car on récupère maintenant le modèle du switch
    284       my ($desc, $type) = split ':', $sw->{description}, 2;
     284      my ($desc, $type) = split m/ : /xms, $sw->{description}, 2;
    285285      printf "%-25s 0--------->>>> %-25s %s\n", $sw->{hostname}, $desc, $sw->{model} if $verbose;
    286286      }
     
    302302      "A"=>"10", "B"=>"11", "C"=>"12", "D"=>"13", "E"=>"14", "F"=>"15"
    303303      );
    304    my @chars = split m//x, $car;
     304   my @chars = split m//xms, $car;
    305305   return $table{$chars[-2]}*16 + $table{$chars[-1]};
    306306   }
     
    312312   my $arp = shift;
    313313
    314    my @paquets = split m/ : /x, $arp;
     314   my @paquets = split m/ : /xms, $arp;
    315315   my $return = '';
    316316   foreach(@paquets) {
     
    612612   my %db_switch_chained_port = ();
    613613   for my $swport (keys %db_switch_connected_on_port) {
    614       my ($sw_connect,$port_connect) = split ':', $swport;
     614      my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
    615615      $db_switch_chained_port{$sw_connect} .= "$port_connect:";
    616616      }
     
    619619      if ( exists $db_switch_chained_port{$sw->{hostname}} ) {
    620620         chop $db_switch_chained_port{$sw->{hostname}};
    621          push @{$sw->{portignore}}, split(':',$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";
     
    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/ \. /x, $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};
    908908
    909909      $computerdb->{$ip}{hostname_fq} = 'unknow' if $computerdb->{$ip}{hostname_fq} =~ m/^ \d+ \. \d+ \. \d+ \. \d+ $/x;
    910       my ( $host_short ) = split m/ \. /x, $computerdb->{$ip}{hostname_fq};
     910      my ( $host_short ) = split m/ \. /xms, $computerdb->{$ip}{hostname_fq};
    911911
    912912      print <<"END_HTML";
     
    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/ \. /x, $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;
    952952
    953       my ( $host_short ) = sprintf "%s %3s" , split(m/ \. /x, $db_switch_parent{$sw}->{switch}, 1), $db_switch_parent{$sw}->{port};
     953      my ( $host_short ) = sprintf "%s %3s" , split(m/ \. /xms, $db_switch_parent{$sw}->{switch}, 1), $db_switch_parent{$sw}->{port};
    954954
    955955      print <<"END_HTML";
     
    981981
    982982   for my $swport (sort keys %db_switch_connected_on_port) {
    983       my ($sw_connect,$port_connect) = split ':', $swport;
     983      my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
    984984      for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
    985985
     
    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/ \. /x, $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;
     
    10031003         if (exists $db_switch_output_port{$sw}) {
    10041004
    1005             my ( $host_short ) = sprintf "%s %3s" , split( m/\./x , $sw, 1), $db_switch_output_port{$sw};
     1005            my ( $host_short ) = sprintf "%s %3s" , split( m/\./xms, $sw, 1), $db_switch_output_port{$sw};
    10061006
    10071007            print <<"END_HTML";
     
    12381238         $maybe_more_than_one_switch_connected = 'yes';
    12391239
    1240          my ($sw_connect,$port_connect) = split ':', $swport;
     1240         my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
    12411241         my @sw_on_same_port = keys %{$db_switch_connected_on_port{$swport}};
    12421242
     
    12891289   print "------------------------------------------------\n";
    12901290   for my $swport (sort keys %db_switch_connected_on_port) {
    1291       my ($sw_connect,$port_connect) = split ':', $swport;
     1291      my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
    12921292      for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
    12931293         if (exists $db_switch_output_port{$sw}) {
     
    13571357   print "------------------------------------------------\n";
    13581358   for my $swport (sort keys %db_switch_connected_on_port) {
    1359       my ($sw_connect,$port_connect) = split ':', $swport;
     1359      my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
    13601360      for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
    13611361         if (exists $db_switch_output_port{$sw}) {
     
    13821382   my %db_building= ();
    13831383   for my $sw (@SWITCH) {
    1384       my ($building, $location) = split m/ \/ /x, $sw->{location}, 2;
     1384      my ($building, $location) = split m/ \/ /xms, $sw->{location}, 2;
    13851385      $db_building{$building} ||= {};
    13861386      $db_building{$building}->{$location} ||= {};
     
    14051405         $l++;
    14061406
    1407          print "\"location$b-$l\" [label = \"$building".'/'.join('\n',split("/",$loc))."\", color = black, fillcolor = orange, style = filled];\n";
     1407         print "\"location$b-$l\" [label = \"$building".'/'.join('\n',split(m{ / }xms, $loc))."\", color = black, fillcolor = orange, style = filled];\n";
    14081408#         print "\"location$b-$l\" [label = \"$building / $loc\", color = black, fillcolor = orange, style = filled];\n";
    14091409         print "\"building$b\" -> \"location$b-$l\" [len = 2, color = firebrick]\n";
     
    14211421
    14221422            for my $swport (keys %db_switch_connected_on_port) {
    1423                my ($sw_connect,$port_connect) = split ':', $swport;
     1423               my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
    14241424               next if not $sw_connect eq $sw;
    14251425               next if $port_connect eq $db_switch_output_port{$sw};
     
    14461446#   print "------------------------------------------------\n";
    14471447   for my $swport (sort keys %db_switch_connected_on_port) {
    1448       my ($sw_connect,$port_connect) = split ':', $swport;
     1448      my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
    14491449      for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
    14501450         if (exists $db_switch_output_port{$sw}) {
Note: See TracChangeset for help on using the changeset viewer.