Skip to content

Commit

Permalink
use terminal "dumb" if probing shows "unknown" - fix #66
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Apr 13, 2024
1 parent c7ff3ed commit f6432dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- Split version checking from `use Alien::Gnuplot` line for easier downstream
packaging. Fixes #98.
- fixes for Windows (#89)
- use terminal "dumb" if probing shows "unknown" (#66)

2.024 2023-03-30
- Add Alien::Gnuplot as a configure-time dependency. Fixes #92 - thanks @zmughal
Expand Down
5 changes: 2 additions & 3 deletions lib/PDL/Graphics/Gnuplot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2300,9 +2300,8 @@ sub output {

if(@_) {
# Check that, if there is at least one more argument, it is recognizable as a terminal
my $terminal;
$terminal = lc(shift);
$terminal = 'windows' if $^O =~ /mswin32/i and $terminal eq 'unknown';
my $terminal = lc(shift);
$terminal = 'dumb' if $terminal eq 'unknown';
##############################
# Check the terminal list here!
if(!exists($this->{valid_terms}->{$terminal})) {
Expand Down
5 changes: 3 additions & 2 deletions t/plot.t
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,15 @@ unlink 'Plot-1.txt' or warn "Can't delete Plot-1.txt after test: $!";
# accepts both array ref and scalar parameters.
eval {$w=gpwin('dumb',size=>[7,5]); $w->line(xvals(50)**2); $w->close;};
is($@, '', "plotting to 42x30 text file worked");
@lines = eval {open FOO,"<Plot-1.txt"; my @l = <FOO>; close FOO;@l};
@lines = eval { open my $fh, "<", "Plot-1.txt" or die "Plot-1.txt: $!"; <$fh> };
is($@, '', "read ASCII plot OK");
eval { unlink 'Plot-1.txt';};

is(@lines+0, 30, "'7x5 inch' ascii plot created 30 lines (created ".(0+@lines).")");

eval {$w=gpwin('dumb',size=>5); $w->line(xvals(50)**2); $w->close;};
is($@, '', "plotting to 30x30 text file worked");
eval {open FOO,"<Plot-1.txt"; @lines = <FOO>; close FOO;};
@lines = eval { open my $fh, "<", "Plot-1.txt" or die "Plot-1.txt: $!"; <$fh> };
is($@, '', "Read ASCII plot #2 OK");
eval { unlink 'Plot-1.txt';};

Expand Down Expand Up @@ -869,6 +869,7 @@ unlink($testoutput) or warn "\$!: $!";
##############################
# Test default output plotting

unlink qw(Plot-1.txt Plot-2.txt);
SKIP: {
if( -e 'Plot-1.txt' || -e 'Plot-2.txt') {
print STDERR "\n***********\nSkipping default-plot-output tests: files 'Plot-1.txt' and/or 'Plot-2.txt' exist.\n***********\n";
Expand Down

0 comments on commit f6432dd

Please sign in to comment.