if($options{blah}) instead of if(defined $options{blah}) when possible. No longer specifying 0-defaults

This commit is contained in:
Dima Kogan 2011-01-03 12:43:12 -08:00
parent 5abd2dc621
commit e3b79b832a

View File

@ -128,16 +128,11 @@ if(exists $ARGV[0] && !-r $ARGV[0])
unshift @ARGV, shellwords shift @ARGV; unshift @ARGV, shellwords shift @ARGV;
} }
# everything off by default:
# do not stream in the data by default # do not stream in the data by default
# point plotting by default. # point plotting by default.
# no monotonicity checks by default # no monotonicity checks by default
my %options = ( stream => 0, my %options = ( maxcurves => 100);
domain => 0,
dataid => 0,
points => 0,
lines => 0,
xlen => 0,
maxcurves => 100);
GetOptions(\%options, GetOptions(\%options,
'stream!', 'stream!',
@ -169,7 +164,7 @@ GetOptions(\%options,
'help', 'help',
'dump') or die($usage); 'dump') or die($usage);
if( defined $options{help} ) if( $options{help} )
{ {
die($usage); die($usage);
} }
@ -196,7 +191,7 @@ my $xwindow;
my $streamingFinished : shared = undef; my $streamingFinished : shared = undef;
if($options{stream}) if($options{stream})
{ {
if( defined $options{hardcopy}) if( $options{hardcopy})
{ {
$options{stream} = undef; $options{stream} = undef;
} }
@ -265,7 +260,7 @@ sub mainThread
my $outputfile; my $outputfile;
my $outputfileType; my $outputfileType;
if( defined $options{hardcopy}) if( $options{hardcopy})
{ {
$outputfile = $options{hardcopy}; $outputfile = $options{hardcopy};
($outputfileType) = $outputfile =~ /\.(ps|pdf|png)$/; ($outputfileType) = $outputfile =~ /\.(ps|pdf|png)$/;
@ -447,7 +442,7 @@ sub mainThread
{ {
plotStoredData(); plotStoredData();
if( defined $options{hardcopy}) if( $options{hardcopy})
{ {
print PIPE "set output\n"; print PIPE "set output\n";
# sleep until the plot file exists, and it is closed. Sometimes the output is # sleep until the plot file exists, and it is closed. Sometimes the output is