diff --git a/CHANGES b/CHANGES index 1e502ef..76cf10a 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/lib/PDL/Graphics/Gnuplot.pm b/lib/PDL/Graphics/Gnuplot.pm index 26b03dc..3877e13 100644 --- a/lib/PDL/Graphics/Gnuplot.pm +++ b/lib/PDL/Graphics/Gnuplot.pm @@ -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})) { diff --git a/t/plot.t b/t/plot.t index 2c55727..b9c30c8 100644 --- a/t/plot.t +++ b/t/plot.t @@ -444,7 +444,7 @@ 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,"; 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';}; @@ -452,7 +452,7 @@ 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,"; 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';}; @@ -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";