Index: trunk/klask
===================================================================
--- trunk/klask	(revision 220)
+++ trunk/klask	(revision 221)
@@ -38,6 +38,6 @@
 my $KLASK_CFG = YAML::Syck::LoadFile("$KLASK_CFG_FILE");
 
-my %DEFAULT     = %{$KLASK_CFG->{default}};
-my @SWITCH_LIST = @{$KLASK_CFG->{switch}};
+my %DEFAULT     = %{$KLASK_CFG->{'default'}};
+my @SWITCH_LIST = @{$KLASK_CFG->{'switch'}};
 
 my %SWITCH_LEVEL = ();
@@ -45,20 +45,20 @@
 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;
 
    # SNMP parameter initialisation
    my %session = ( -hostname   => $sw->{hostname} );
-   $session{-version} = $sw->{version}   || 1;
-   $session{-port}    = $sw->{snmpport}  || $DEFAULT{snmpport}  || 161;
-   if (exists $sw->{version} and $sw->{version} eq '3') {
-      $session{-username} = $sw->{username} || 'snmpadmin';
+   $session{-version} = $sw->{'version'}  || 1;
+   $session{-port}    = $sw->{'snmpport'} || $DEFAULT{'snmpport'}  || 161;
+   if (exists $sw->{'version'} and $sw->{'version'} eq '3') {
+      $session{-username} = $sw->{'username'} || 'snmpadmin';
       }
    else {
-      $session{-community} = $sw->{community} || $DEFAULT{community} || 'public';
-      }
-   $sw->{snmp_param_session} = \%session;
-   }
-@SWITCH_LIST = reverse sort { $SWITCH_LEVEL{$a->{hostname}} <=> $SWITCH_LEVEL{$b->{hostname}} } @{$KLASK_CFG->{switch}};
+      $session{-community} = $sw->{'community'} || $DEFAULT{'community'} || 'public';
+      }
+   $sw->{'snmp_param_session'} = \%session;
+   }
+@SWITCH_LIST = reverse sort { $SWITCH_LEVEL{$a->{hostname}} <=> $SWITCH_LEVEL{$b->{hostname}} } @{$KLASK_CFG->{'switch'}};
 
 #my %SWITCH_PORT_COUNT = ();
@@ -357,5 +357,5 @@
    INIT_EACH_SWITCH:
    for my $sw (@SWITCH_LIST) {
-      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;
 
@@ -474,10 +474,10 @@
       }
 
-   my $research1 = $OID_NUMBER{searchPort1} . mac_address_hex_to_dec($mac_address);
-   my $research2 = $OID_NUMBER{searchPort2} .'.'. $vlan_id . mac_address_hex_to_dec($mac_address);
+   my $research1 = $OID_NUMBER{'searchPort1'} . mac_address_hex_to_dec($mac_address);
+   my $research2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex_to_dec($mac_address);
 
    LOOP_ON_SWITCH:
    for my $sw (@switch_search) {
-      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;
 
@@ -533,9 +533,9 @@
    return $ret if $mac_address eq 'unknow';
 
-   my $research1 = $OID_NUMBER{searchPort1} . mac_address_hex_to_dec($mac_address);
-   my $research2 = $OID_NUMBER{searchPort2} .'.'. $vlan_id . mac_address_hex_to_dec($mac_address);
+   my $research1 = $OID_NUMBER{'searchPort1'} . mac_address_hex_to_dec($mac_address);
+   my $research2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex_to_dec($mac_address);
    LOOP_ON_ALL_SWITCH:
    for my $sw (@SWITCH_LIST) {
-      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;
 
@@ -782,6 +782,6 @@
    my ($sw) = @_;
 
-   my %session = %{$sw->{snmp_param_session}};
-   $session{-community} = $sw->{community-rw} || $DEFAULT{community-rw} || 'private';
+   my %session = %{$sw->{'snmp_param_session'}};
+   $session{-community} = $sw->{'community-rw'} || $DEFAULT{'community-rw'} || 'private';
    return %session;
    }
@@ -1526,7 +1526,7 @@
 
       if (exists $db_switch_parent{$sw}) {
-         my $mac_address = $db_switch{$db_switch_parent{$sw}->{switch}}->{mac_address};
-         my $ipv4_address = $db_switch{$db_switch_parent{$sw}->{switch}}->{ipv4_address};
-         my $timestamp = $db_switch{$db_switch_parent{$sw}->{switch}}->{timestamp};
+         my $mac_address = $db_switch{$db_switch_parent{$sw}->{'switch'}}->{mac_address};
+         my $ipv4_address = $db_switch{$db_switch_parent{$sw}->{'switch'}}->{ipv4_address};
+         my $timestamp = $db_switch{$db_switch_parent{$sw}->{'switch'}}->{timestamp};
 
          my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $timestamp;
@@ -1539,5 +1539,5 @@
          my $mac_sort = sprintf '%04i-%s', 9999, $mac_address;
 
-         my ( $host_short ) = sprintf '%s %3s' , split(m/ \. /xms, $db_switch_parent{$sw}->{switch}, 1), $db_switch_parent{$sw}->{port_hr};
+         my ( $host_short ) = sprintf '%s %3s' , split(m/ \. /xms, $db_switch_parent{$sw}->{'switch'}, 1), $db_switch_parent{$sw}->{port_hr};
 
          print <<"END_HTML";
@@ -1546,5 +1546,5 @@
    <td class="bklask-port">$db_switch_output_port{$sw}</td>
    <td>$arrow</td><td>$db_switch_parent{$sw}->{port_hr}</td>
-   <td sorttable_customkey="$host_short">$db_switch_parent{$sw}->{switch}</td>
+   <td sorttable_customkey="$host_short">$db_switch_parent{$sw}->{'switch'}</td>
    <td sorttable_customkey="$ip_sort">$ipv4_address</td>
    <td sorttable_customkey="$mac_sort">$mac_address</td>
@@ -1741,11 +1741,11 @@
          }
 
-      my $research1 = $OID_NUMBER{searchPort1} . mac_address_hex_to_dec($mac_address);
-      my $research2 = $OID_NUMBER{searchPort2} .'.'. 0 . mac_address_hex_to_dec($mac_address);
+      my $research1 = $OID_NUMBER{'searchPort1'} . mac_address_hex_to_dec($mac_address);
+      my $research2 = $OID_NUMBER{'searchPort2'} .'.'. 0 . mac_address_hex_to_dec($mac_address);
       print "Klask search OID $research1 on switch $sw_name\n";
       print "Klask search OID $research2 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;
 
@@ -1797,5 +1797,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;
 
@@ -1874,5 +1874,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;
 
@@ -2172,5 +2172,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;
 
@@ -2223,11 +2223,11 @@
          }
 
-      my $research1 = $OID_NUMBER{searchPort1} . mac_address_hex_to_dec($mac_address);
-      my $research2 = $OID_NUMBER{searchPort2} .'.'. $vlan_id . mac_address_hex_to_dec($mac_address);
+      my $research1 = $OID_NUMBER{'searchPort1'} . mac_address_hex_to_dec($mac_address);
+      my $research2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex_to_dec($mac_address);
       print "Klask search OID $research1 on switch $sw_name\n" if $verbose;
       print "Klask search OID $research2 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;
 
@@ -2442,5 +2442,5 @@
    for my $sw (sort keys %db_switch_output_port) {
       if (exists $db_switch_parent{$sw}) {
-         printf "%-28s  %2s  +-->  %2s  %-25s\n", $sw, $db_switch_output_port{$sw}, $db_switch_parent{$sw}->{port_hr}, $db_switch_parent{$sw}->{switch};
+         printf "%-28s  %2s  +-->  %2s  %-25s\n", $sw, $db_switch_output_port{$sw}, $db_switch_parent{$sw}->{port_hr}, $db_switch_parent{$sw}->{'switch'};
          }
       else {
@@ -2512,5 +2512,5 @@
    for my $sw (sort keys %db_switch_output_port) {
       if (exists $db_switch_parent{$sw}) {
-         printf "%-28s  %2s  +-->  %2s  %-25s\n", $sw, $db_switch_output_port{$sw}, $db_switch_parent{$sw}->{port_hr}, $db_switch_parent{$sw}->{switch};
+         printf "%-28s  %2s  +-->  %2s  %-25s\n", $sw, $db_switch_output_port{$sw}, $db_switch_parent{$sw}->{port_hr}, $db_switch_parent{$sw}->{'switch'};
          }
       else {
@@ -2611,5 +2611,5 @@
    for my $sw (sort keys %db_switch_output_port) {
       if (exists $db_switch_parent{$sw}) {
-#         printf "   \"%s:%s\" -> \"%s:%s\"\n", $sw, $db_switch_output_port{$sw}, $db_switch_parent{$sw}->{switch}, $db_switch_parent{$sw}->{port};
+#         printf "   \"%s:%s\" -> \"%s:%s\"\n", $sw, $db_switch_output_port{$sw}, $db_switch_parent{$sw}->{'switch'}, $db_switch_parent{$sw}->{port};
          }
       else {
