You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2013/09/19 18:03:21 UTC

svn commit: r1524775 - /vcl/trunk/managementnode/lib/VCL/DataStructure.pm

Author: arkurth
Date: Thu Sep 19 16:03:21 2013
New Revision: 1524775

URL: http://svn.apache.org/r1524775
Log:
VCL-727
Added optional $show_warnings argument to DataStructure.pm::get_variable.

Modified:
    vcl/trunk/managementnode/lib/VCL/DataStructure.pm

Modified: vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=1524775&r1=1524774&r2=1524775&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/DataStructure.pm Thu Sep 19 16:03:21 2013
@@ -1817,16 +1817,18 @@ EOF
 
 =head2 get_variable
 
- Parameters  : variable name
+ Parameters  : $variable_name, $show_warnings (optional)
  Returns     : If successful: data stored in the variable table for the variable name specified
                If failed: false
  Description : Queries the variable table for the variable with the name
-					specified by the argument. Returns the data stored for the
-					variable. Values are deserialized before being returned if the
-					value stored was a reference.
-					
-					Undefined is returned if the variable name does not exist in the
-					variable table.
+               specified by the argument. Returns the data stored for the
+               variable. Values are deserialized before being returned if the
+               value stored was a reference.
+               
+               Undefined is returned if the variable name does not exist in the
+               variable table. A log message is displayed by default. To
+               suppress the log message, supply the $show_warnings argument with
+               a value of 0.
 
 =cut
 
@@ -1842,6 +1844,9 @@ sub get_variable {
 		return;
 	}
 	
+	my $show_warnings = shift;
+	$show_warnings = 1 unless defined $show_warnings;
+	
 	# Construct the select statement
 my $select_statement .= <<"EOF";
 SELECT
@@ -1858,7 +1863,7 @@ EOF
 
 	# Check to make 1 sure row was returned
 	if (!@selected_rows){
-		notify($ERRORS{'OK'}, 0, "variable '$variable_name' is not set in the database");
+		notify($ERRORS{'OK'}, 0, "variable '$variable_name' is not set in the database") if $show_warnings;
 		return 0;
 	}
 	elsif (@selected_rows > 1){