[PATCH] kannel.monitor

"Dariusz Markowicz" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <031501c2fd1c$bb012040$1900000a@toster>
Hi List,

This patch solves problem with some warnings when
kannel.monitor module is runining under perl 5.8.0 (with -w option):

Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 71.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 72.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 186.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 191.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 192.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 193.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 194.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 197.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 198.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 199.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 207.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 229.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 247.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 264.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 284.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 292.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 304.
Using a hash as a reference is deprecated at ./mon/mon.d/kannel.monitor line 328.

Please vote and comment and commit :) Patch was tested under perl 5.8.0 and 5.6.1.

best regards,
Dariusz Markowicz
monitor.diff (application/octet-stream, 4.3 KB)
--- gateway/contrib/mon/kannel.monitor	Mon Apr  7 17:05:17 2003
+++ gateway-custom/contrib/mon/kannel.monitor	Mon Apr  7 17:08:31 2003
@@ -68,8 +68,8 @@
         my $response=$ua->get($url)||
         do { &err($host);&info("GET request to $host failed \n");next};
         &info("OK\n");
-        if ((%{$response}->{'_content'})){
-            my $doc=%{$response}->{'_content'};
+        if ((${$response}{'_content'})){
+            my $doc=${$response}{'_content'};
             $p->parse($doc);
         } # end if
         else{do { &err($host);&info("GET request to $host failed \n");next}}
@@ -183,20 +183,20 @@
     #==============================
     for ($count=1;$count>=0;$count++){
 
-	if ($count==1 && ! %{"box".$count}->{'status'}){
+	if ($count==1 && ! ${"box".$count}{'status'}){
     	    info "No SMS- or WAP-Box is running!!\n";
 	    push @failures, "No SMS- or WAP-Box is running!!\n";
 	} #end if
 
-	elsif ((%{"box".$count}->{'status'}
-	       &&(split /\s+/,%{"box".$count}->{'status'})[0] ne 'on-line')){
-	    info %{"box".$count}->{'type'}." is not running!!\n";
-	    push @failures, hostname().": ".%{"box".$count}->{'type'}." is not running!!\n";
+	elsif ((${"box".$count}{'status'}
+	       &&(split /\s+/,${"box".$count}{'status'})[0] ne 'on-line')){
+	    info ${"box".$count}{'type'}." is not running!!\n";
+	    push @failures, hostname().": ".${"box".$count}{'type'}." is not running!!\n";
 	} # end elsif
 
-    	last unless (%{"box".$count}->{'type'}
-		     &&((%{"box".$count}->{'type'} eq 'smsbox')
-		     || (%{"box".$count}->{'type'} eq 'wapbox')));
+    	last unless (${"box".$count}{'type'}
+		     &&((${"box".$count}{'type'} eq 'smsbox')
+		     || (${"box".$count}{'type'} eq 'wapbox')));
     } # end for count (SMS-Box)
     
     # SMSC does not run:
@@ -204,7 +204,7 @@
     for ($count=1;$count>=0;$count++){
         last unless (exists ${"smsc".$count}{id});
         if (${"smsc".$count}{id}){          
-            %exists->{${"smsc".$count}{id}}=1;
+            $exists{${"smsc".$count}{id}}=1;
             if ((split /\s+/,${"smsc".$count}{status})[0] ne 'online'){
             local $smsc_not;
                 if ($opts{n}){
@@ -226,7 +226,7 @@
     #==============================
     if ($opts{n}){
         foreach $arg (split /\s+/, $opts{n}){
-            unless (exists %exists->{$arg}){
+            unless (exists $exists{$arg}){
                 info "$arg does not exist\n";
                 push @failures, $arg;
             } #end unless
@@ -244,7 +244,7 @@
         ($field,$value,$time)=split /\|/, $_,3;
         $diffmin=(time - $time)/60;
         
-        if ((%{"sms"}->{$field} - $value)/$diffmin >= $qlimit){
+        if ((${"sms"}{$field} - $value)/$diffmin >= $qlimit){
             $warncount+=1;
         } # end if
     } # end while STATUSFILE
@@ -261,7 +261,7 @@
          if ((split /_/,$field)[1]
              &&(split /_/,$field)[1] eq 'queued'){
              printf(STATUSFILE "%s|%s|%d\n", 
-                    $field,%{"sms"}->{$field},time);
+                    $field,${"sms"}{$field},time);
          } # end if
      } # end foreach
 
@@ -281,7 +281,7 @@
 
      printf("============SMS Overall==================\n");
      foreach $field (keys %{"sms"}){
-         printf("%s -> %s\n", $field,%{"sms"}->{$field});
+         printf("%s -> %s\n", $field,${"sms"}{$field});
      }
      printf("=========================================\n");
 
@@ -289,7 +289,7 @@
          if (exists ${"box".$bcount}{type});
     while (exists ${"box".$bcount}{type}){
         foreach $field (keys %{"box".$bcount}){
-            printf("%s -> %s\n", $field,%{"box".$bcount}->{$field});
+            printf("%s -> %s\n", $field,${"box".$bcount}{$field});
         } # end foreach
         ++$bcount;
         printf("=========================================\n");
@@ -301,7 +301,7 @@
     }
     while (exists ${"smsc".$count}{id}){
         foreach $field (keys %{"smsc".$count}){
-            printf("%s -> %s\n", $field,%{"smsc".$count}->{$field});
+            printf("%s -> %s\n", $field,${"smsc".$count}{$field});
         } # end foreach
         printf("=========================================\n");
         ++$count;
@@ -325,7 +325,7 @@
 
   if ($value!~/^\s+$/){
 
-        while($level=%parent->{$level}){
+        while($level=$parent{$level}){
             unshift @level, $level;
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.