Index: /trunk/klask
===================================================================
--- /trunk/klask	(revision 49)
+++ /trunk/klask	(revision 50)
@@ -148,6 +148,6 @@
 
 #   my $cmdarping  = `arping -c 1 -w 1 -rR $param 2>/dev/null`;
-   if (not $param_ip_or_host =~ m/^\d+\.\d+\.\d+\.\d+$/) {
-      $param_ip_or_host =~ s/\..*//;
+   if ( not $param_ip_or_host =~ m/^\d+ \. \d+ \. \d+ \. \d+$/x ) {
+      $param_ip_or_host =~ s/ \. .* //x;
       }
 
@@ -161,5 +161,5 @@
    my $cmd_arpwatch = `$cmd`;
    chomp $cmd_arpwatch;
-   my ($arp, $ip, $timestamp, $host) = split /\s+/, $cmd_arpwatch;
+   my ($arp, $ip, $timestamp, $host) = split m/ \s+ /x, $cmd_arpwatch;
 
    $ret{ipv4_address} = $ip        if $ip;
@@ -179,5 +179,5 @@
    my $cmd_arp  = `arp -a $param_ip_or_host 2>/dev/null`;
    chomp $cmd_arp;
-   $cmd_arp =~ /(\S*)\s\(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\)\sat\s([0-9,A-Z]{2}:[0-9,A-Z]{2}:[0-9,A-Z]{2}:[0-9,A-Z]{2}:[0-9,A-Z]{2}:[0-9,A-Z]{2})/;
+   $cmd_arp =~ /(\S*)\s\(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\)\sat\s([0-9,A-Z]{2}:[0-9,A-Z]{2}:[0-9,A-Z]{2}:[0-9,A-Z]{2}:[0-9,A-Z]{2}:[0-9,A-Z]{2})/x;
    $ret{hostname_fq}  = $1 if(defined($1));
    $ret{ipv4_address} = $2 if(defined($2));
@@ -188,14 +188,14 @@
    my $cmd_host = `host $param_ip_or_host 2>/dev/null`;
    chomp $cmd_host;
-   $cmd_host =~ m/domain\sname\spointer\s(\S+)\.$/;
+   $cmd_host =~ m/domain \s name \s pointer \s (\S+) \.$/x;
    $ret{hostname_fq} = $1 if defined $1;
 
    # resultat de la commande host si parametre est hostname
    # tech7meylan.hmg.inpg.fr has address 194.254.66.240
-   $cmd_host =~ m/(\S*)\shas\saddress\s([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$/;
+   $cmd_host =~ m/(\S*) \s has \s address \s ( [0-9]{1,3} \. [0-9]{1,3} \. [0-9]{1,3} \. [0-9]{1,3} )$/x;
    $ret{hostname_fq}  = $1 if defined $1;
    $ret{ipv4_address} = $2 if defined $2;
 
-   $cmd_host =~ m/\b([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.in-addr\.arpa\s/;
+   $cmd_host =~ m/ \b ([0-9]{1,3}) \. ([0-9]{1,3}) \. ([0-9]{1,3}) \. ([0-9]{1,3}) \. in-addr \. arpa \s/x;
    $ret{ipv4_address} = "$4.$3.$2.$1"     if defined $1 and  defined $2 and  defined $3 and  defined $4;
    $ret{hostname_fq}  = $param_ip_or_host if not defined $1 and $ret{hostname_fq} eq 'unknow';
@@ -203,6 +203,6 @@
    unless ($ret{mac_address} eq 'unknow') {
       my @paquets = ();
-      foreach ( split(/:/, $ret{mac_address}) ) {
-         my @chars = split //, uc("00$_");
+      foreach ( split m/ : /x, $ret{mac_address} ) {
+         my @chars = split m//x, uc("00$_");
          push @paquets, "$chars[-2]$chars[-1]";
          }
@@ -218,5 +218,5 @@
 
    for my $sw_kind (keys %SWITCH_KIND) {
-      next if not $sw_snmp_description =~ m/$SWITCH_KIND{$sw_kind}->{match}/;
+      next if not $sw_snmp_description =~ m/$SWITCH_KIND{$sw_kind}->{match}/x;
 
       return $SWITCH_KIND{$sw_kind}->{model};
@@ -287,5 +287,5 @@
       "A"=>"10", "B"=>"11", "C"=>"12", "D"=>"13", "E"=>"14", "F"=>"15"
       );
-   my @chars = split //, $car;
+   my @chars = split m//x, $car;
    return $table{$chars[-2]}*16 + $table{$chars[-1]};
    }
@@ -297,5 +297,5 @@
    my $arp = shift;
 
-   my @paquets = split /:/, $arp;
+   my @paquets = split m/ : /x, $arp;
    my $return = '';
    foreach(@paquets) {
@@ -441,5 +441,5 @@
       my $net = new NetAddr::IP $cidr;
       for my $ip (@$net) {
-         $ip =~ s#/32##;
+         $ip =~ s{ /32 }{}x;
          push @res,  $ip;
          }
@@ -732,5 +732,5 @@
 
    my $dirdb = $KLASK_DB_FILE;
-      $dirdb =~ s#/[^/]*$##;
+      $dirdb =~ s{ / [^/]* $}{}x;
    mkdir "$dirdb", 0755 unless -d "$dirdb";
    YAML::Syck::DumpFile("$KLASK_DB_FILE", $computerdb);
@@ -760,5 +760,5 @@
 
    my $dirdb = $KLASK_DB_FILE;
-      $dirdb =~ s#/[^/]*$##;
+      $dirdb =~ s{ / [^/]* $}{}x;
    mkdir "$dirdb", 0755 unless -d "$dirdb";
    YAML::Syck::DumpFile("$KLASK_DB_FILE", $computerdb);
@@ -888,10 +888,10 @@
       my $switch_hostname_sort = sprintf "%s %3s" ,$switch_hostname, $computerdb->{$ip}{switch_port};
 
-      my $ip_sort = sprintf "%03i%03i%03i%03i", split( /\./, $ip);
+      my $ip_sort = sprintf "%03i%03i%03i%03i", split( m/ \. /x, $ip);
 
       my $mac_sort = sprintf "%04i-%s", 9999 - $mac_count{$computerdb->{$ip}{mac_address}}, $computerdb->{$ip}{mac_address};
 
-      $computerdb->{$ip}{hostname_fq} = 'unknow' if $computerdb->{$ip}{hostname_fq} =~ m/^\d+\.\d+\.\d+\.\d+$/;
-      my ( $host_short ) = split /\./, $computerdb->{$ip}{hostname_fq};
+      $computerdb->{$ip}{hostname_fq} = 'unknow' if $computerdb->{$ip}{hostname_fq} =~ m/^ \d+ \. \d+ \. \d+ \. \d+ $/x;
+      my ( $host_short ) = split m/ \. /x, $computerdb->{$ip}{hostname_fq};
 
       print <<"END_HTML";
@@ -932,9 +932,9 @@
       my $date = sprintf "%04i-%02i-%02i %02i:%02i", $year,$mon,$mday,$hour,$min;
 
-      my $ip_sort = sprintf "%03i%03i%03i%03i", split( /\./, $ipv4_address);
+      my $ip_sort = sprintf "%03i%03i%03i%03i", split( m/ \. /x, $ipv4_address);
 
       my $mac_sort = sprintf "%04i-%s", 9999, $mac_address;
 
-      my ( $host_short ) = sprintf "%s %3s" , split(/\./, $db_switch_parent{$sw}->{switch}, 1), $db_switch_parent{$sw}->{port};
+      my ( $host_short ) = sprintf "%s %3s" , split(m/ \. /x, $db_switch_parent{$sw}->{switch}, 1), $db_switch_parent{$sw}->{port};
 
       print <<"END_HTML";
@@ -980,5 +980,5 @@
       my $date = sprintf "%04i-%02i-%02i %02i:%02i", $year,$mon,$mday,$hour,$min;
 
-      my $ip_sort = sprintf "%03i%03i%03i%03i", split( /\./, $ipv4_address);
+      my $ip_sort = sprintf "%03i%03i%03i%03i", split( m/ \. /x, $ipv4_address);
 
       my $mac_sort = sprintf "%04i-%s", 9999, $mac_address;
@@ -988,5 +988,5 @@
          if (exists $db_switch_output_port{$sw}) {
 
-            my ( $host_short ) = sprintf "%s %3s" , split(/\./, $sw, 1), $db_switch_output_port{$sw};
+            my ( $host_short ) = sprintf "%s %3s" , split( m/\./x , $sw, 1), $db_switch_output_port{$sw};
 
             print <<"END_HTML";
@@ -1367,5 +1367,5 @@
    my %db_building= ();
    for my $sw (@SWITCH) {
-      my ($building, $location) = split /\//, $sw->{location}, 2;
+      my ($building, $location) = split m/ \/ /x, $sw->{location}, 2;
       $db_building{$building} ||= {};
       $db_building{$building}->{$location} ||= {};
