my $MyConfigVar=0; sub import { # Import gets called with a package and a list of items # We want to pick off the ones that start with - and # handle. Other cases need to be handled as they are # encountered my $package = shift; $Trace = new TracePkg unless defined($Trace); $Trace->entry(); my @params = @_; foreach my $item (@params){ if ($item =~ s/^-//){ my $varname = $item; $varname =~ s/^no_//i; my $oldvalue = eval "\$$varname"; if ($item =~ /^no_/i){ eval "\$$varname = 0"; } else { eval "\$$varname = 1"; } my $newvalue = eval "\$$varname"; $Trace->comment(msg => "Handled param $varname. Changed from $oldvalue to $newvalue."); } else { $Trace->warn(msg => "Did not handle param $item"); } } # I haven't figured out why we need this statement but commenting it out will cause # the variable to get reset. $Trace->trace(msg => "Var=$MyConfigVar"); $Trace->exit(); }