From eacba49833f8efc74dae1b3a7c31ce8dadf62d0f Mon Sep 17 00:00:00 2001 From: nott Date: Thu, 18 Apr 2013 15:54:48 +0000 Subject: [PATCH] add clroptionvars git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16015 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 5bfb5a12b..f3b601e6d 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -117,6 +117,38 @@ This program module file, is a set of utilities used by xCAT commands. #------------------------------------------------------------- +=head3 clroptionvars + + - use this routine to clear GetOptions global option variables + before calling GetOptions. + + - this may be needed because a "command" may be called twice + from the same process - and global options may have been + set the first time through. (ex. from a plugin using runxcmd() ) + + - should really avoid global vars but this provides a quick fix + for now + + ex. my $rc = xCAT::Utils->clroptionvars($::opt1, $::opt2 ...) + +=cut + +#------------------------------------------------------- +sub clroptionvars +{ + # skip the class arg and set the rest to undef + my $skippedclass=0; + foreach (@_) { + if ($skippedclass) { + $_ = undef; + } + $skippedclass=1; + } + return 0; +} + +#------------------------------------------------------------- + =head3 genUUID Returns an RFC 4122 compliant UUIDv4 or UUIDv1 Arguments: