#!/usr/local/bin/perl # # jwcctl_common.pm # # Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. # # NAME # jwcctl_common.pm - JWC Control Action Script Common Library Module # # DESCRIPTION # jwcctl_common.pm - Common library module for JWC Control # # NOTES # # MODIFIED (MM/DD/YY) # jgrout 08/21/15 - Create localhost loopback global constant # jgrout 04/17/15 - Adapt for JWC Checker # jgrout 02/27/15 - Adapt for JWC Control from OC4J Control # jgrout 10/15/14 - Fix bug 19426384 # jgrout 01/31/12 - Created package jwcctl_common; use strict; use warnings; our $VERSION = '1'; use English; # Perl status codes use constant { SUCC_CODE => 0 , FAIL_CODE => 1 , ERROR_PID => -1 , NULL_PID => -2 }; # Agent script entry status codes (CLSAGFW_AE_*) use constant { ENTRY_SUCCESS => 0 , ENTRY_FAIL => 1 }; # Agent script check status codes (CLSAGFW_*) use constant { STATE_ONLINE => 0 , STATE_OFFLINE => 1 , STATE_UNKNOWN => 3 , STATE_FAILED => 5 }; # Checker request codes use constant { CHECK_ONCE => "1" , CHECK_UNTIL_ACTION_TIMEOUT => "-1" }; # localhost loopback use constant { LOCALHOST => "localhost" }; our $debug_out_set; our (@ISA, @EXPORT); # Export in a BEGIN block to avoid compilation failure BEGIN { require Exporter; @ISA = qw(Exporter); my @exp_const = qw(SUCC_CODE FAIL_CODE ERROR_PID NULL_PID ENTRY_SUCCESS ENTRY_FAIL STATE_ONLINE STATE_OFFLINE STATE_UNKNOWN STATE_FAILED CHECK_ONCE CHECK_UNTIL_ACTION_TIMEOUT LOCALHOST ); my @exp_func = qw(debug_out set_debug_out unset_debug_out ); my @exp = (@exp_const, @exp_func); @EXPORT = @exp; } sub set_debug_out() { $debug_out_set = 1; } sub unset_debug_out() { $debug_out_set = 0; } sub debug_out #--------------------------------------------------------------------- # Function: Print debugging list if set_debug_out has been called # # Args : Debugging list to print # # Returns : None #--------------------------------------------------------------------- { if ($debug_out_set == 1) { print STDOUT "[jwcctl debug]"; foreach (@_) { print STDOUT " ", $_; } print STDOUT "\n"; } } 1;