Index: /trunk/klask
===================================================================
--- /trunk/klask	(revision 368)
+++ /trunk/klask	(revision 369)
@@ -4,4 +4,6 @@
 #
 # $Id$
+#
+# perltidy -i=3 -ci=3 -pt=2 -icb -cti=3 -sbt=2 -bt=2 -bbt=2 -nsfs -bar -otr -olc -nolq -l=132 -vmll -msc=1 -iscl -nbbc -nola -st klask > klask.tmp
 
 use strict;
@@ -47,5 +49,5 @@
 LEVEL_OF_EACH_SWITCH:
 for my $sw (@SWITCH_LIST) {
-   $SWITCH_LEVEL{$sw->{'hostname'}} = $sw->{'level'} || $DEFAULT{'switch_level'}  || 2;
+   $SWITCH_LEVEL{$sw->{'hostname'}} = $sw->{'level'} || $DEFAULT{'switch_level'} || 2;
    $SWITCH_DB{$sw->{'hostname'}} = $sw;
 
@@ -62,5 +64,5 @@
    $sw->{'snmp_param_session'} = \%session;
    }
-@SWITCH_LIST = reverse sort { $SWITCH_LEVEL{$a->{'hostname'}} <=> $SWITCH_LEVEL{$b->{'hostname'}} } @{$KLASK_CFG->{'switch'}};
+@SWITCH_LIST = reverse sort {$SWITCH_LEVEL{$a->{'hostname'}} <=> $SWITCH_LEVEL{$b->{'hostname'}}} @{$KLASK_CFG->{'switch'}};
 
 #my %SWITCH_PORT_COUNT = ();
@@ -177,16 +179,16 @@
    sysContact      => '1.3.6.1.2.1.1.4.0',
    sysLocation     => '1.3.6.1.2.1.1.6.0',
-   searchPort1     => '1.3.6.1.2.1.17.4.3.1.2',          # BRIDGE-MIB (802.1D).
-   searchPort2     => '1.3.6.1.2.1.17.7.1.2.2.1.2',      # Q-BRIDGE-MIB (802.1Q) add 0 if unknown vlan id
-   vlanPortDefault => '1.3.6.1.2.1.17.7.1.4.5.1.1',      # dot1qPvid
-   vlanStatus      => '1.3.6.1.2.1.17.7.1.4.3.1.5',      # integer 4 Create, 6 Destroy
-   vlanName        => '1.3.6.1.2.1.17.7.1.4.3.1.1',      # string
-   HPicfReset      => '1.3.6.1.4.1.11.2.14.11.1.4.1',    # HP reboot switch
-   ifIndex         => '1.3.6.1.2.1.17.1.4.1.2',          # dot1dBasePortIfIndex - Interface index redirection
-   ifName          => '1.3.6.1.2.1.31.1.1.1.1',          # Interface name (give port number)
-   portUpDown      => '1.3.6.1.2.1.2.2.1.7',             # 1.3.6.1.2.1.2.2.1.7.NoPort = 1 (up)  = 2 (down)
-   poeState        => '1.3.6.1.2.1.105.1.1.1.3.1',       # 1.3.6.1.2.1.105.1.1.1.3.1.NoPort = 1 (poe up)  = 2 (poe down) - Cisco and Zyxel
-   NApoeState      => '1.3.6.1.4.1.266.20.3.1.1.21',     # .NoPort = 2 (poe off)  = 8 (poe atHighPower) - Nexans
-   ifAggregator    => '1.2.840.10006.300.43.1.2.1.1.12', # dot3adAggPortSelectedAggID - 0 not part of an  Aggregator - Ciso Dell HP Comware -  See https://stackoverflow.com/questions/14960157/how-to-map-portchannel-to-interfaces-via-snmp https://gist.github.com/bldewolf/6314435
+   searchPort1     => '1.3.6.1.2.1.17.4.3.1.2',       # BRIDGE-MIB (802.1D).
+   searchPort2     => '1.3.6.1.2.1.17.7.1.2.2.1.2',   # Q-BRIDGE-MIB (802.1Q) add 0 if unknown vlan id
+   vlanPortDefault => '1.3.6.1.2.1.17.7.1.4.5.1.1',   # dot1qPvid
+   vlanStatus      => '1.3.6.1.2.1.17.7.1.4.3.1.5',   # integer 4 Create, 6 Destroy
+   vlanName        => '1.3.6.1.2.1.17.7.1.4.3.1.1',   # string
+   HPicfReset      => '1.3.6.1.4.1.11.2.14.11.1.4.1', # HP reboot switch
+   ifIndex         => '1.3.6.1.2.1.17.1.4.1.2',       # dot1dBasePortIfIndex - Interface index redirection
+   ifName          => '1.3.6.1.2.1.31.1.1.1.1',       # Interface name (give port number)
+   portUpDown      => '1.3.6.1.2.1.2.2.1.7',          # 1.3.6.1.2.1.2.2.1.7.NoPort = 1 (up)  = 2 (down)
+   poeState        => '1.3.6.1.2.1.105.1.1.1.3.1',    # 1.3.6.1.2.1.105.1.1.1.3.1.NoPort = 1 (poe up)  = 2 (poe down) - Cisco and Zyxel
+   NApoeState      => '1.3.6.1.4.1.266.20.3.1.1.21',  # .NoPort = 2 (poe off)  = 8 (poe atHighPower) - Nexans
+   ifAggregator => '1.2.840.10006.300.43.1.2.1.1.12', # dot3adAggPortSelectedAggID - 0 not part of an  Aggregator - Ciso Dell HP Comware -  See https://stackoverflow.com/questions/14960157/how-to-map-portchannel-to-interfaces-via-snmp https://gist.github.com/bldewolf/6314435
    );
 
@@ -201,5 +203,5 @@
 Readonly my $RE_FLOAT_HOSTNAME => $DEFAULT{'float-regex'} || qr{ ^float }xms;
 
-Readonly my $SEP_AGGREGATOR_PORT => ',';  # : is already use to join switch and port
+Readonly my $SEP_AGGREGATOR_PORT => ','; # : is already use to join switch and port
 Readonly my $SEP_SWITCH_PORT     => ':';
 
@@ -269,7 +271,7 @@
 sub resolve_ip_arp_host {
    my $param_ip_or_host = shift;
-   my $interface = shift || q{*};
-   my $type      = shift || q{fast};
-   my $already   = shift || q{yes};
+   my $interface        = shift || q{*};
+   my $type             = shift || q{fast};
+   my $already          = shift || q{yes};
 
    my %ret = (
@@ -307,5 +309,5 @@
    my $nowtimestamp = time;
 
-   if ( $type eq 'fast' and ( not defined $timestamp or $timestamp < ( $nowtimestamp - 45 * 60 ) ) ) { # 45 min
+   if ($type eq 'fast' and (not defined $timestamp or $timestamp < ($nowtimestamp - 45 * 60))) { # 45 min
       $ret{'mac_address'} = 'unknow';
       return %ret;
@@ -328,12 +330,12 @@
       # Last chance to have the mac_address
       if ($ret{'interface'} eq '*') {
-         my $cmd_arp  = shell_command "ip neigh show to $ret{'ipv4_address'}";
-         if ( $cmd_arp =~ m{ ^$RE_IPv4_ADDRESS \s dev \s ([\w\d\.\:]+) \s lladdr \s ( $RE_MAC_ADDRESS ) \s }xms ) {
+         my $cmd_arp = shell_command "ip neigh show to $ret{'ipv4_address'}";
+         if ($cmd_arp =~ m{ ^$RE_IPv4_ADDRESS \s dev \s ([\w\d\.\:]+) \s lladdr \s ( $RE_MAC_ADDRESS ) \s }xms) {
             ($ret{'interface'}, $ret{'mac_address'}) = ($1, $2);
             }
          }
       else {
-         my $cmd_arp  = shell_command "ip neigh show to $ret{'ipv4_address'} dev $ret{'interface'}";
-         if ( $cmd_arp =~ m{ ^$RE_IPv4_ADDRESS \s lladdr \s ( $RE_MAC_ADDRESS ) \s }xms ) {
+         my $cmd_arp = shell_command "ip neigh show to $ret{'ipv4_address'} dev $ret{'interface'}";
+         if ($cmd_arp =~ m{ ^$RE_IPv4_ADDRESS \s lladdr \s ( $RE_MAC_ADDRESS ) \s }xms) {
             $ret{'mac_address'} = $1;
             }
@@ -344,5 +346,5 @@
    if ($ret{'mac_address'} ne 'unknow') {
       my @paquets = ();
-      for ( split m/ : /xms, $ret{'mac_address'} ) {
+      for (split m/ : /xms, $ret{'mac_address'}) {
          my @chars = split m//xms, uc "00$_";
          push @paquets, "$chars[-2]$chars[-1]";
@@ -391,10 +393,10 @@
    my ($verbose, $verb_description, $check_hostname, $check_location) = @_;
 
-   printf "%-26s                %-25s %s\n",'Switch','Description','Type(Revision)' if $verbose;
+   printf "%-26s                %-25s %s\n", 'Switch', 'Description', 'Type(Revision)' if $verbose;
    print "----------------------------------------------------------------------------------\n" if $verbose;
 
    INIT_EACH_SWITCH:
    for my $sw (my @CLONE = @SWITCH_LIST) { # Make a local clone because some element can be deleted
-      my ($session, $error) = Net::SNMP->session( %{$sw->{'snmp_param_session'}} );
+      my ($session, $error) = Net::SNMP->session(%{$sw->{'snmp_param_session'}});
       print "$error \n" if $error;
 
@@ -411,5 +413,5 @@
          $session->close();
          # Remove bad switch
-         @SWITCH_LIST = grep { $_->{'hostname'} ne $sw->{'hostname'} } @SWITCH_LIST;
+         @SWITCH_LIST = grep {$_->{'hostname'} ne $sw->{'hostname'}} @SWITCH_LIST;
          delete $SWITCH_LEVEL{$sw->{'hostname'}} if exists $SWITCH_LEVEL{$sw->{'hostname'}};
          delete $SWITCH_DB{$sw->{'hostname'}}    if exists $SWITCH_DB{$sw->{'hostname'}};
@@ -1721,5 +1723,5 @@
       next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{'hostname_fq'} eq ($computerdb->{$ip}{'switch_hostname'} || $computerdb->{$ip}{'switch_description'}); # switch on himself !
 
-      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{'timestamp'};
+      my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime $computerdb->{$ip}{'timestamp'};
       $year += 1900;
       $mon++;
@@ -1729,6 +1731,6 @@
       $vlan = $computerdb->{$ip}{'network'}.'('.get_current_vlan_id($computerdb->{$ip}{'network'}).')' if $computerdb->{$ip}{'network'};
 
-      my $arrow ='<---';
-         $arrow ='<===' if $computerdb->{$ip}{'switch_port_hr'} =~ m/^(Trk|Br|Po)/;
+      my $arrow = '<---';
+      $arrow = '<===' if $computerdb->{$ip}{'switch_port_hr'} =~ m/^(Trk|Br|Po)/;
 
       $tb_computer->add(
@@ -1757,6 +1759,6 @@
    my $computerdb = computerdb_load();
 
-#<link rel="stylesheet" type="text/css" href="style-klask.css" />
-#<script src="sorttable-klask.js"></script>
+   #<link rel="stylesheet" type="text/css" href="style-klask.css" />
+   #<script src="sorttable-klask.js"></script>
 
    print <<'END_HTML';
@@ -1796,17 +1798,17 @@
       next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{'hostname_fq'} eq ($computerdb->{$ip}{'switch_hostname'} || $computerdb->{$ip}{'switch_description'}); # switch on himself !
 
-      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{'timestamp'};
+      my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime $computerdb->{$ip}{'timestamp'};
       $year += 1900;
       $mon++;
       my $date = sprintf '%04i-%02i-%02i %02i:%02i', $year, $mon, $mday, $hour, $min;
 
-#      $odd_or_even++;
-#      my $typerow = $odd_or_even % 2 ? 'odd' : 'even';
+      #      $odd_or_even++;
+      #      my $typerow = $odd_or_even % 2 ? 'odd' : 'even';
       $typerow = $typerow eq 'even' ? 'odd' : 'even';
 
       #my $arrow ='&#8592;';
       #   $arrow ='&#8656;' if $computerdb->{$ip}{'switch_port_hr'} =~ m/^(Trk|Br|Po)/;
-      my $arrow ='&#10229;';
-         $arrow ='&#10232;' if $computerdb->{$ip}{'switch_port_hr'} =~ m/^(Trk|Br|Po)/;
+      my $arrow = '&#10229;';
+      $arrow = '&#10232;' if $computerdb->{$ip}{'switch_port_hr'} =~ m/^(Trk|Br|Po)/;
 
       my $switch_hostname = $computerdb->{$ip}{'switch_hostname'} || $computerdb->{$ip}{'switch_description'} || 'unkown';
@@ -1819,5 +1821,5 @@
 
       $computerdb->{$ip}{'hostname_fq'} = 'unknow' if $computerdb->{$ip}{'hostname_fq'} =~ m/^ \d+ \. \d+ \. \d+ \. \d+ $/xms;
-      my ( $host_short ) = split m/ \. /xms, $computerdb->{$ip}{'hostname_fq'};
+      my ($host_short) = split m/ \. /xms, $computerdb->{$ip}{'hostname_fq'};
 
       my $vlan = '';
@@ -1860,6 +1862,6 @@
       #my $arrow ='&#8702;';
       #   $arrow ='&#8680;' if $db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/;
-      my $arrow ='&#10236;';
-         $arrow ='&#10238;' if $db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/;
+      my $arrow = '&#10236;';
+      $arrow = '&#10238;' if $db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/;
 
       if (exists $db_switch_parent{$sw}) {
@@ -1872,5 +1874,5 @@
          my $timestamp    = $db_switch{$db_switch_parent{$sw}->{'switch'}}->{'timestamp'};
 
-         my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $timestamp;
+         my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime $timestamp;
          $year += 1900;
          $mon++;
@@ -1911,9 +1913,9 @@
          my $host_short = format_switchport4sort($sw, $db_switch_output_port{$sw});
 
-         my $mac_address = $db_switch{$sw}->{'mac_address'};
+         my $mac_address  = $db_switch{$sw}->{'mac_address'};
          my $ipv4_address = $db_switch{$sw}->{'ipv4_address'};
-         my $timestamp = $db_switch{$sw}->{'timestamp'};
-
-         my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $timestamp;
+         my $timestamp    = $db_switch{$sw}->{'timestamp'};
+
+         my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime $timestamp;
          $year += 1900;
          $mon++;
@@ -1925,8 +1927,8 @@
 
          my $vlan = $db_switch{$sw}->{'network'};
-         $vlan .= ' ('.get_current_vlan_id($db_switch{$sw}->{'network'}).')' if $db_switch{$sw}->{'network'};
-
-         my $arrow ='&#10235;';
-            $arrow ='&#10237;' if $db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/;
+         $vlan .= ' (' . get_current_vlan_id($db_switch{$sw}->{'network'}) . ')' if $db_switch{$sw}->{'network'};
+
+         my $arrow = '&#10235;';
+         $arrow = '&#10237;' if $db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/;
 
          fqdn_html_breakable($sw);
@@ -1955,12 +1957,12 @@
          my $switch_hostname_sort = format_switchport4sort($sw_connect, $port_connect);
 
-         my $mac_address = $db_switch{$sw}->{'mac_address'};
+         my $mac_address  = $db_switch{$sw}->{'mac_address'};
          my $ipv4_address = $db_switch{$sw}->{'ipv4_address'};
-         my $timestamp = $db_switch{$sw}->{'timestamp'};
-
-         my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $timestamp;
+         my $timestamp    = $db_switch{$sw}->{'timestamp'};
+
+         my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime $timestamp;
          $year += 1900;
          $mon++;
-         my $date = sprintf '%04i-%02i-%02i %02i:%02i', $year,$mon,$mday,$hour,$min;
+         my $date = sprintf '%04i-%02i-%02i %02i:%02i', $year, $mon, $mday, $hour, $min;
 
          my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ [\.\*] /xms, $ipv4_address; # \* for fake-ip
@@ -1972,13 +1974,13 @@
          #my $arrow ='&#8701;';
          #   $arrow ='&#8678;' if $port_connect =~ m/^(Trk|Br|Po)/;
-         my $arrow ='&#10235;';
-            $arrow ='&#10237;' if $port_connect =~ m/^(Trk|Br|Po)/;
+         my $arrow = '&#10235;';
+         $arrow = '&#10237;' if $port_connect =~ m/^(Trk|Br|Po)/;
 
          my $vlan = $db_switch{$sw}->{'network'};
-         $vlan .= ' ('.get_current_vlan_id($db_switch{$sw}->{'network'}).')' if $db_switch{$sw}->{'network'};
+         $vlan .= ' (' . get_current_vlan_id($db_switch{$sw}->{'network'}) . ')' if $db_switch{$sw}->{'network'};
 
          if (exists $db_switch_output_port{$sw}) {
 
-            my $host_short = format_switchport4sort(split( m/\./xms, $sw, 1), $db_switch_output_port{$sw});
+            my $host_short = format_switchport4sort(split(m/\./xms, $sw, 1), $db_switch_output_port{$sw});
 
             my $parent_port_hr = format_aggregator4html($port_connect);
@@ -2051,6 +2053,6 @@
 
    GetOptions(
-      'day|d=i'      => \$days_before_alert,
-      'format|f=s'   => \$format,
+      'day|d=i'    => \$days_before_alert,
+      'format|f=s' => \$format,
       );
 
@@ -2058,5 +2060,5 @@
       txt  => \&cmd_bad_vlan_id_txt,
       html => \&cmd_bad_vlan_id_html,
-      none => sub {},
+      none => sub { },
       );
    $format = 'txt' if not defined $possible_format{$format};
@@ -2114,13 +2116,13 @@
       next LOOP_ON_RECENT_COMPUTER if $switchportdb{$swpt}->{'hostname_fq'} !~ m/$RE_FLOAT_HOSTNAME/;
 
-      my $src_ip = $switchportdb{$swpt}->{'ip'};
+      my $src_ip        = $switchportdb{$swpt}->{'ip'};
       my $src_timestamp = 0;
       LOOP_ON_IP_ADDRESS:
       for my $ip (keys %{$computerdb}) {
-         next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{'mac_address'} ne  $switchportdb{$swpt}->{'mac_address'};
+         next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{'mac_address'} ne $switchportdb{$swpt}->{'mac_address'};
          next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{'hostname_fq'} =~ m/$RE_FLOAT_HOSTNAME/;
          next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{'timestamp'} < $src_timestamp;
 
-         $src_ip = $ip;
+         $src_ip        = $ip;
          $src_timestamp = $computerdb->{$ip}{'timestamp'};
          }
@@ -2130,10 +2132,10 @@
       next LOOP_ON_RECENT_COMPUTER if $switchportdb{$swpt}->{'timestamp'} < $src_timestamp;
 
-      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $switchportdb{$swpt}->{'timestamp'};
+      my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime $switchportdb{$swpt}->{'timestamp'};
       $year += 1900;
       $mon++;
       my $date = sprintf '%04i-%02i-%02i/%02i:%02i', $year, $mon, $mday, $hour, $min;
 
-      ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$src_ip}{'timestamp'};
+      ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime $computerdb->{$src_ip}{'timestamp'};
       $year += 1900;
       $mon++;
@@ -2142,10 +2144,10 @@
       my $vlan_id = get_current_vlan_id($computerdb->{$src_ip}{'network'});
       my ($switch_hostname, $port_hr) = split /\s+/, $swpt, 2;
-      
+
       push @result, {
          switch      => $switch_hostname,
          port_hr     => $port_hr,
          vlan_bad    => $switchportdb{$swpt}->{'vlan'},
-         vlan_good   =>$computerdb->{$src_ip}{'network'},
+         vlan_good   => $computerdb->{$src_ip}{'network'},
          vlan_id     => $vlan_id,
          date_last   => $date,
@@ -2231,5 +2233,5 @@
 
       my $switch_hostname_sort = format_switchport4sort($item->{'switch'}, $item->{'port_hr'});
-      my ( $host_short ) = split m/ \. /xms, $item->{'hostname_fq'};
+      my ($host_short) = split m/ \. /xms, $item->{'hostname_fq'};
 
       my $vlan_nameid = $item->{'vlan_good'} . ' (' . $item->{'vlan_id'} . ')';
@@ -2298,5 +2300,5 @@
          -varbindlist => [$oid_search, INTEGER, 8], # Only NEXANS
          );
-      print $session->error()."\n" if $session->error_status();
+      print $session->error() . "\n" if $session->error_status();
 
       $session->close;
@@ -2336,5 +2338,5 @@
          -varbindlist => [$oid_search, INTEGER, 2], # Only NEXANS
          );
-      print $session->error()."\n" if $session->error_status();
+      print $session->error() . "\n" if $session->error_status();
 
       $session->close;
@@ -2368,5 +2370,5 @@
 
       my $sw = $SWITCH_DB{$sw_name};
-      my ($session, $error) = Net::SNMP->session( %{$sw->{'snmp_param_session'}} );
+      my ($session, $error) = Net::SNMP->session(%{$sw->{'snmp_param_session'}});
       print "$error \n" if $error;
 
@@ -2400,5 +2402,5 @@
       );
 
-   my $switch_name = shift @ARGV || q{};
+   my $switch_name     = shift @ARGV || q{};
    my $switch_location = shift @ARGV || q{};
 
@@ -2438,5 +2440,5 @@
       }
 
-   $switch_name = join(',', map {$_->{'hostname'}} @SWITCH_LIST ) if $switch_name eq q{*};
+   $switch_name = join(',', map {$_->{'hostname'}} @SWITCH_LIST) if $switch_name eq q{*};
 
    for my $sw_name (split /,/, $switch_name) {
@@ -2446,10 +2448,10 @@
 
       my $oid_search_port1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
-      my $oid_search_port2 = $OID_NUMBER{'searchPort2'} .'.'. 0 . mac_address_hex2dec($mac_address);
+      my $oid_search_port2 = $OID_NUMBER{'searchPort2'} . '.' . 0 . mac_address_hex2dec($mac_address);
       print "Klask search OID $oid_search_port1 on switch $sw_name\n";
       print "Klask search OID $oid_search_port2 on switch $sw_name\n";
 
       my $sw = $SWITCH_DB{$sw_name};
-      my ($session, $error) = Net::SNMP->session( %{$sw->{'snmp_param_session'}} );
+      my ($session, $error) = Net::SNMP->session(%{$sw->{'snmp_param_session'}});
       print "$error \n" if $error;
 
@@ -2501,5 +2503,5 @@
 
       my $sw = $SWITCH_DB{$sw_name};
-      my ($session, $error) = Net::SNMP->session( %{$sw->{'snmp_param_session'}} );
+      my ($session, $error) = Net::SNMP->session(%{$sw->{'snmp_param_session'}});
       print "$error \n" if $error;
 
@@ -2568,5 +2570,5 @@
       }
 
-   $switch_name = join(',', map {$_->{'hostname'}} @SWITCH_LIST ) if $switch_name eq q{*};
+   $switch_name = join(',', map {$_->{'hostname'}} @SWITCH_LIST) if $switch_name eq q{*};
 
    for my $sw_name (split /,/, $switch_name) {
@@ -2578,5 +2580,5 @@
 
       my $sw = $SWITCH_DB{$sw_name};
-      my ($session, $error) = Net::SNMP->session( %{$sw->{'snmp_param_session'}} );
+      my ($session, $error) = Net::SNMP->session(%{$sw->{'snmp_param_session'}});
       print "$error \n" if $error;
 
@@ -2606,5 +2608,5 @@
       }
 
-   $switch_name = join(',', map {$_->{'hostname'}} @SWITCH_LIST ) if $switch_name eq q{*};
+   $switch_name = join(',', map {$_->{'hostname'}} @SWITCH_LIST) if $switch_name eq q{*};
 
    for my $sw_name (split /,/, $switch_name) {
@@ -2614,5 +2616,5 @@
 
       my $sw = $SWITCH_DB{$sw_name};
-      my ($session, $error) = Net::SNMP->session( %{$sw->{'snmp_param_session'}} );
+      my ($session, $error) = Net::SNMP->session(%{$sw->{'snmp_param_session'}});
       print "$error \n" if $error;
 
@@ -2662,7 +2664,7 @@
 
    GetOptions(
-      'day|d=i'      => \$days_to_death,
-      'format|f=s'   => \$format,
-      'verbose|v'    => \$verbose,
+      'day|d=i'    => \$days_to_death,
+      'format|f=s' => \$format,
+      'verbose|v'  => \$verbose,
       );
 
@@ -2670,5 +2672,5 @@
       txt  => \&cmd_ip_free_txt,
       html => \&cmd_ip_free_html,
-      none => sub {},
+      none => sub { },
       );
    $format = 'txt' if not defined $possible_format{$format};
@@ -2678,5 +2680,5 @@
 
    my $computerdb = {};
-      $computerdb = computerdb_load() if -e "$KLASK_DB_FILE";
+   $computerdb = computerdb_load() if -e "$KLASK_DB_FILE";
    my $timestamp = time;
 
@@ -2706,5 +2708,5 @@
          my $ip_date_last_detection = '';
          if (exists $computerdb->{$ip}) {
-            my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{'timestamp'};
+            my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime $computerdb->{$ip}{'timestamp'};
             $year += 1900;
             $mon++;
@@ -2712,5 +2714,5 @@
             }
 
-         my $packed_ip = scalar gethostbyname($ip);
+         my $packed_ip   = scalar gethostbyname($ip);
          my $hostname_fq = 'unknown';
             $hostname_fq = scalar gethostbyaddr($packed_ip, AF_INET) || 'unknown' if defined $packed_ip and get_current_scan_mode($vlan) eq 'active';
@@ -2720,6 +2722,6 @@
          $result_ip{$ip} ||= {};
          $result_ip{$ip}->{'date_last_detection'} = $ip_date_last_detection;
-         $result_ip{$ip}->{'hostname_fq'} = $hostname_fq;
-         $result_ip{$ip}->{'vlan'} = $vlan;
+         $result_ip{$ip}->{'hostname_fq'}         = $hostname_fq;
+         $result_ip{$ip}->{'vlan'}                = $vlan;
 
          printf "VERBOSE_1: %-15s %-12s %s\n", $ip, $vlan, $hostname_fq if $verbose;
@@ -2745,5 +2747,5 @@
    LOOP_ON_IP_ADDRESS:
    for my $ip (Net::Netmask::sort_by_ip_address(keys %result_ip)) {
-      my $vlan_nameid = $result_ip{$ip}->{'vlan'}.'('.get_current_vlan_id($result_ip{$ip}->{'vlan'}).')';
+      my $vlan_nameid = $result_ip{$ip}->{'vlan'} . '(' . get_current_vlan_id($result_ip{$ip}->{'vlan'}) . ')';
       #printf "%-15s %-40s %-16s %s\n", $ip, $result_ip{$ip}->{'hostname_fq'}, $result_ip{$ip}->{'date_last_detection'}, $vlan_nameid;
       $tb_computer->add(
@@ -2785,7 +2787,7 @@
 
       my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ \. /xms, $ip;
-      my ( $host_short ) = split m/ \. /xms, $result_ip{$ip}->{'hostname_fq'};
-
-      my $vlan_nameid = $result_ip{$ip}->{'vlan'}.' ('.get_current_vlan_id($result_ip{$ip}->{'vlan'}).')';
+      my ($host_short) = split m/ \. /xms, $result_ip{$ip}->{'hostname_fq'};
+
+      my $vlan_nameid = $result_ip{$ip}->{'vlan'} . ' (' . get_current_vlan_id($result_ip{$ip}->{'vlan'}) . ')';
 
       fqdn_html_breakable(my $hostname_fq_html = $result_ip{$ip}->{'hostname_fq'});
@@ -2843,5 +2845,5 @@
    die "Error : Port $port_hr does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/;
 
-   my $oid_search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id;
+   my $oid_search_portstatus = $OID_NUMBER{'portUpDown'} . '.' . $port_id;
    print "Info: switch $switch_name port $port_hr SNMP OID $oid_search_portstatus\n" if $verbose;
 
@@ -2888,5 +2890,5 @@
    die "Error : Port $port_hr does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/;
 
-   my $oid_search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id;
+   my $oid_search_portstatus = $OID_NUMBER{'portUpDown'} . '.' . $port_id;
    print "Info: switch $switch_name port $port_hr SNMP OID $oid_search_portstatus\n" if $verbose;
 
@@ -2924,5 +2926,5 @@
 
    my $sw = $SWITCH_DB{$switch_name};
-   my ($session, $error) = Net::SNMP->session( %{$sw->{'snmp_param_session'}} );
+   my ($session, $error) = Net::SNMP->session(%{$sw->{'snmp_param_session'}});
    print "$error \n" if $error;
 
@@ -2931,5 +2933,5 @@
    die "Error : Port $port_hr does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/;
 
-   my $oid_search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id;
+   my $oid_search_portstatus = $OID_NUMBER{'portUpDown'} . '.' . $port_id;
    print "Info: switch $switch_name port $port_hr ($port_id) SNMP OID $oid_search_portstatus\n" if $verbose;
 
@@ -2968,5 +2970,5 @@
 
    $mac_address = normalize_mac_address($mac_address);
-   $switch_name = join(',', map {$_->{'hostname'}} @SWITCH_LIST ) if $switch_name eq q{*} or $switch_name eq q{all};
+   $switch_name = join(',', map {$_->{'hostname'}} @SWITCH_LIST) if $switch_name eq q{*} or $switch_name eq q{all};
 
    for my $sw_name (split /,/, $switch_name) {
@@ -2976,10 +2978,10 @@
 
       my $oid_search_port1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
-      my $oid_search_port2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex2dec($mac_address);
+      my $oid_search_port2 = $OID_NUMBER{'searchPort2'} . '.' . $vlan_id . mac_address_hex2dec($mac_address);
       print "Klask search OID $oid_search_port1 on switch $sw_name\n" if $verbose;
       print "Klask search OID $oid_search_port2 on switch $sw_name\n" if $verbose;
 
       my $sw = $SWITCH_DB{$sw_name};
-      my ($session, $error) = Net::SNMP->session( %{$sw->{'snmp_param_session'}} );
+      my ($session, $error) = Net::SNMP->session(%{$sw->{'snmp_param_session'}});
       print "$error \n" if $error;
 
@@ -3027,12 +3029,12 @@
    test_switchdb_environnement();
 
-   my $format = 'txt';
+   my $format       = 'txt';
    my $graph_modulo = 0;
    my $graph_shift  = 1;
 
    GetOptions(
-      'format|f=s'  => \$format,
-      'modulo|m=i'  => \$graph_modulo,
-      'shift|s=i'   => \$graph_shift,
+      'format|f=s' => \$format,
+      'modulo|m=i' => \$graph_modulo,
+      'shift|s=i'  => \$graph_shift,
       );
 
@@ -3070,6 +3072,6 @@
       );
    for my $sw (sort keys %db_switch_output_port) {
-      my $arrow ='--->';
-         $arrow ='===>' if $db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/;
+      my $arrow = '--->';
+      $arrow = '===>' if $db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/;
       if (exists $db_switch_parent{$sw}) {
          $tb_child->add($sw, $db_switch_output_port{$sw}, $arrow, $db_switch_parent{$sw}->{'port_hr'}, $db_switch_parent{$sw}->{'switch'});
@@ -3080,14 +3082,14 @@
          }
       }
-   my @colrange = map { scalar $tb_child->colrange($_) } (0 .. 4); # force scaler context
-   $tb_child->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table output
+   my @colrange = map {scalar $tb_child->colrange($_)} (0 .. 4); # force scaler context
+   $tb_child->add(map {' ' x $_} reverse @colrange);             # add empty line to force symetric table output
    print $tb_child->title();
    print $tb_child->rule('-');
-   print $tb_child->body(0, $tb_child->body_height()-1); # remove last fake line
+   print $tb_child->body(0, $tb_child->body_height() - 1);       # remove last fake line
    $tb_child->clear;
 
    # Switch parent and children port inter-connection
    print "\n";
-   my $tb_parent = Text::Table->new( # http://www.perlmonks.org/?node_id=988320
+   my $tb_parent = Text::Table->new(                             # http://www.perlmonks.org/?node_id=988320
       {align => 'left',   align_title => 'left',   title => 'Parent-Switch'},
       {align => 'right',  align_title => 'right',  title => 'Input-Port'},
@@ -3099,6 +3101,6 @@
       my ($sw_connect, $port_connect) = split m/ $SEP_SWITCH_PORT /xms, $swport, 2;
       for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
-         my $arrow ='<---';
-            $arrow ='<===' if $port_connect =~ m/^(Trk|Br|Po)/;
+         my $arrow = '<---';
+         $arrow = '<===' if $port_connect =~ m/^(Trk|Br|Po)/;
          if (exists $db_switch_output_port{$sw}) {
             $tb_parent->add($sw_connect, $port_connect, $arrow, $db_switch_output_port{$sw}, $sw);
@@ -3109,9 +3111,9 @@
          }
       }
-   @colrange = map { scalar $tb_parent->colrange($_) } (0 .. 4); # force scaler context
-   $tb_parent->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table output
+   @colrange = map {scalar $tb_parent->colrange($_)} (0 .. 4); # force scaler context
+   $tb_parent->add(map {' ' x $_} reverse @colrange);          # add empty line to force symetric table output
    print $tb_parent->title();
    print $tb_parent->rule('-');
-   print $tb_parent->body(0, $tb_parent->body_height()-1); # remove last fake line
+   print $tb_parent->body(0, $tb_parent->body_height() - 1);   # remove last fake line
    $tb_parent->clear;
 
@@ -3135,5 +3137,5 @@
    my $invisible_node = 0; # Count number of invisible node
 
-   my %db_building= ();
+   my %db_building    = ();
    my %db_switch_line = (); # Number of line drawed on a switch
    for my $sw (values %db_switch_global) {
@@ -3141,5 +3143,5 @@
       $db_building{$building} ||= {};
       $db_building{$building}->{$location} ||= {};
-      $db_building{$building}->{$location}{ $sw->{'hostname'} } = 'y';
+      $db_building{$building}->{$location}{$sw->{'hostname'}} = 'y';
 
       $db_switch_line{$sw} = 0;
@@ -3154,5 +3156,5 @@
    print "internet [label=\"internet\", color=black, fillcolor=cyan, shape=house, style=filled];\n";
 
-   my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $timestamp;
+   my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime $timestamp;
    $year += 1900;
    $mon++;
@@ -3161,5 +3163,5 @@
    print "site -> \"$date\" [style=invis];\n";
 
-   my $b=0;
+   my $b = 0;
    for my $building (keys %db_building) {
       $b++;
@@ -3179,8 +3181,8 @@
 
             my $peripheries = 1;
-            my $color = 'lightblue';
+            my $color       = 'lightblue';
             if ($db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/) {
                $peripheries = 2;
-               $color = "\"$color:$color\"";
+               $color       = "\"$color:$color\"";
                }
             print "\"$sw:$db_switch_output_port{$sw}\" [label=\"".format_aggregator4dot($db_switch_output_port{$sw})."\", color=black, fillcolor=lightblue, peripheries=$peripheries, style=filled];\n";
@@ -3198,8 +3200,8 @@
                next if $port_connect eq $db_switch_output_port{$sw};
                my $peripheries = 1;
-               my $color = 'plum';
+               my $color       = 'plum';
                if ($port_connect =~ m/^(Trk|Br|Po)/) {
                   $peripheries = 2;
-                  $color = "\"$color:$color\"";
+                  $color       = "\"$color:$color\"";
                   }
                print "\"$sw:$port_connect\" [label=\"".format_aggregator4dot($port_connect)."\", color=black, fillcolor=plum, peripheries=$peripheries, style=filled];\n";
@@ -3215,11 +3217,11 @@
                #   print "$invisible            -> \"$sw\"    [style=invis]\n";
                #   }
-              }
+               }
             }
          }
       }
 
-#   print "Switch output port and parent port connection\n";
-#   print "---------------------------------------------\n";
+   #   print "Switch output port and parent port connection\n";
+   #   print "---------------------------------------------\n";
    for my $sw (sort keys %db_switch_output_port) {
       if (exists $db_switch_parent{$sw}) {
@@ -3241,6 +3243,6 @@
    my $graph_breaker = 1;
 
-#   print "Switch parent and children port inter-connection\n";
-#   print "------------------------------------------------\n";
+   #   print "Switch parent and children port inter-connection\n";
+   #   print "------------------------------------------------\n";
    for my $swport (sort keys %db_switch_connected_on_port) {
       my ($sw_connect, $port_connect) = split m/ $SEP_SWITCH_PORT /xms, $swport, 2;
@@ -3282,5 +3284,5 @@
       }
 
-print "}\n";
+   print "}\n";
    return;
    }
