Skip to content

Commit

Permalink
shortcut reduces indent
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Jan 26, 2023
1 parent 53076fc commit 59bf75b
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions lib/PDL/Graphics/Gnuplot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4878,31 +4878,25 @@ our $pOptionsTable =
'[pseudo] Antonym for "binary" (default is 0 for non-Microsoft platforms).' ],
'device' => [ sub { my ($old, $new, $hash) = @_;
barf "Can't set device while in multiplot mode!\n" if($hash->{multiplot});
if( $new =~ m/^(.*)\/([^\/]*)$/ ) {
$hash->{terminal} = $2;
$hash->{output} = $1 || undef;
} else {
barf("Device option format: [<filename>]/<terminal-type>\n");
}
barf "Device option format: [<filename>]/<terminal-type>\n"
if $new !~ m/^(.*)\/([^\/]*)$/;
$hash->{terminal} = $2;
$hash->{output} = $1 || undef;
return undef;
},
sub { "" }, undef, undef,
'[pseudo] Shorthand for device spec.: "dev=>\'<output/<terminal>\'".' ],

'hardcopy' => [ sub { my ($old, $new, $hash) = @_;
barf "Can't set hardcopy while in multiplot mode!\n" if($hash->{multiplot});
if( $new =~ m/\.([a-z]+)$/i) {
my $suffix = lc $1;
if($hardCopySuffixes->{$suffix}) {
$hash->{terminal} = $hardCopySuffixes->{$suffix};
$hash->{output} = $new;
return undef;
} else {
die "hardcopy: couldn't identify file type from '$new'\n";
}
} else {
die "hardcopy: need a file suffix to infer file type\n";
}
die "hardcopy: need a file suffix to infer file type\n"
if $new !~ m/\.([a-z]+)$/i;
my $suffix = lc $1;
die "hardcopy: couldn't identify file type from '$new'\n"
if !$hardCopySuffixes->{$suffix};
$hash->{terminal} = $hardCopySuffixes->{$suffix};
$hash->{output} = $new;
return undef;
}, sub {""},undef,undef,
'[pseudo] Shorthand for device spec.: standard image formats inferred by suffix' ],

Expand Down

0 comments on commit 59bf75b

Please sign in to comment.