Create a gist now

Instantly share code, notes, and snippets.

# interactive gnuplot terminal
use Hook::LexWrap;
wrap 'Chart::Gnuplot::_execute',
pre => sub { my ( $self ) = @_;
# if this isn't an x11 terminal, there's nothing to do
return unless $self->{terminal} eq "x11";
# add 'pause' command to script to keep image from immediately disappearing
open(GPH, ">>$self->{_script}") || confess("Can't write $self->{_script}");
print GPH "\npause mouse button1\n";
close(GPH);
# output is not a file, delete the 'output' param or we'll get an error in _execute
delete $self->{output};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment