Gnuplot::Builder::Wgnuplot - wrap wgnuplot with gnuplot_builder_tempfile_wrapper


    ## use Gnuplot::Builder;         ## instead of Gnuplot::Builder...
    use Gnuplot::Builder::Wgnuplot;  ## use this in Windows interactive session.
    my $script = gscript(terminal => "windows");
    $script->plot("sin(x)", "cos(x)");


Gnuplot::Builder::Wgnuplot is a drop-in replacement (or strictly speaking, a wrapper) for Gnuplot::Builder. It loads Gnuplot::Builder and sets

    @Gnuplot::Builder::Process::COMMAND = qw(gnuplot_builder_tempfile_wrapper wgnuplot -persist)

This means it changes the back-end to "wgnuplot" and script text is given to it as a temporary file.

Note that if you use Gnuplot::Builder::Wgnuplot, you cannot get diagnostic messages from plotting methods such as plot(). This is because "wgnuplot" does not use pipes at all and gnuplot_builder_tempfile_wrapper discards the output in the first place.

Why Do I Need This?

It seems "wgnuplot" is the only implementation in Windows platform that can handle persistent plot windows correctly.

Use this module if and only if you are on Windows and you want to plot graphs in interactive plot windows (i.e. use "windows" or "wxt" terminals).


As of gnuplot 4.6, "wgnuplot" has a bug that it turns into a never-ending zombie process if it does not create a plot window.

This means if you call ghelp(), "wgnuplot" process persists even after you close the help window. To terminate the process, you have to use the Task Manager.


Gnuplot::Builder::Wgnuplot exports just the same functions as Gnuplot::Builder.



Toshio Ito, <toshioito at>