[Resmon-devel] [resmon commit] r314 - branches/resmon2/lib/Core

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Fri Apr 23 16:07:12 EDT 2010


Author: mark
Date: 2010-04-23 16:07:11 -0400 (Fri, 23 Apr 2010)
New Revision: 314

Modified:
   branches/resmon2/lib/Core/DiskFree.pm
   branches/resmon2/lib/Core/DiskInodes.pm
   branches/resmon2/lib/Core/Pgrep.pm
Log:
Change modules to use die instead of manually returning an error metric

Modified: branches/resmon2/lib/Core/DiskFree.pm
===================================================================
--- branches/resmon2/lib/Core/DiskFree.pm	2010-04-23 20:07:07 UTC (rev 313)
+++ branches/resmon2/lib/Core/DiskFree.pm	2010-04-23 20:07:11 UTC (rev 314)
@@ -99,9 +99,7 @@
         };
     } else {
         # We couldn't get the free space
-        return {
-            "error" => ["Unable to get free space", "s"]
-        }
+        die "Unable to get free space\n";
     }
 };
 

Modified: branches/resmon2/lib/Core/DiskInodes.pm
===================================================================
--- branches/resmon2/lib/Core/DiskInodes.pm	2010-04-23 20:07:07 UTC (rev 313)
+++ branches/resmon2/lib/Core/DiskInodes.pm	2010-04-23 20:07:11 UTC (rev 314)
@@ -117,9 +117,7 @@
         };
     } else {
         # We couldn't match the output line
-        return {
-            "error" => ["Unable to get free inode count", "s"]
-        }
+        die "Unable to get free inode count\n";
     }
 };
 

Modified: branches/resmon2/lib/Core/Pgrep.pm
===================================================================
--- branches/resmon2/lib/Core/Pgrep.pm	2010-04-23 20:07:07 UTC (rev 313)
+++ branches/resmon2/lib/Core/Pgrep.pm	2010-04-23 20:07:11 UTC (rev 314)
@@ -74,11 +74,7 @@
     my $full = $config->{full} ? "f" : "";
 
     my $count = run_command("$pgrep_path", "-c$full", "$config->{pattern}");
-    if (!defined($count)) {
-        return {
-            "error" => ["Unable to run pgrep command", "s"]
-        }
-    }
+    die "Unable to run pgrep command\n" if (!defined($count));
     chomp $count;
 
     if ($count =~ /^\d+$/) {
@@ -88,9 +84,7 @@
     } else {
         # We didn't get a count as expected. This can happen if you didn't
         # provide a pattern or something else went wrong.
-        return {
-            "error" => ["Pgrep gave unexpected output: $count", "s"]
-        };
+        die "Pgrep gave unexpected output: $count\n";
     };
 };
 



More information about the Resmon-devel mailing list