NAME

Gnuplot::Builder::TempFile - gnuplot wrapper using temporary files

SYNOPSIS

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

DESCRIPTION

Gnuplot::Builder::TempFile is an implementation of gnuplot_builder_tempfile_wrapper command bundled in this distribution.

gnuplot_builder_tempfile_wrapper wraps a gnuplot process with a temporary file. It receives script text from STDIN, stores the text into the temporary file and executes the real gnuplot with the temporary file. It also tries to clean up the temporary file it created.

Note that gnuplot_builder_tempfile_wrapper discards output (STDOUT and STDERR) from the real gnuplot process. This means you cannot see diagnostic messages if something goes wrong in the gnuplot process.

gnuplot_builder_tempfile_wrapper is meant to be used with Gnuplot::Builder as a replacement of the real gnuplot command. See the "SYNOPSIS" section for usage.

Why Do I Need This?

Usually you don't. I guess it is more efficient to stream script into the real gnuplot process.

However, in some platforms (such as Windows) gnuplot behaves strangely when you stream script through a pipe. I found it especially difficult to keep plot windows open, so I created this.

If you are in trouble with Windows gnuplot, Gnuplot::Builder::Wgnuplot may help.

FUNCTIONS

All functions are exported only by request.

run(@gnuplot_command)

This function executes the following steps.

  1. Open a temporary file.

  2. Receive data from STDIN and write the data to the temporary file.

  3. After STDIN is closed, execute @gnuplot_command in a separate process with the path to the temporary file appended to the arguments.

    This is basically the same as

        system(@gnuplot_command, $path_to_temp_file);

    except that it won't wait for the process to finish.

    If @gnuplot_command is empty, it uses ("gnuplot", "--persist") by default.

  4. Execute gnuplot_builder_tempfile_remover bundled in this distribution in a seprate process.

    This is basically the same as

        system("gnuplot_builder_tempfile_remover", $path_to_temp_file);

    except that it won't wait for the process to finish.

    gnuplot_builder_tempfile_remover removes the temporary file after waiting for a while, then exits.

SEE ALSO

REPOSITORY

https://github.com/debug-ito/Gnuplot-Builder-TempFile

BUGS AND FEATURE REQUESTS

Please report bugs and feature requests to my Github issues https://github.com/debug-ito/Gnuplot-Builder-TempFile/issues.

Although I prefer Github, non-Github users can use CPAN RT https://rt.cpan.org/Public/Dist/Display.html?Name=Gnuplot-Builder-TempFile. Please send email to bug-Gnuplot-Builder-TempFile at rt.cpan.org to report bugs if you do not have CPAN RT account.

AUTHOR

Toshio Ito, <toshioito at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2014 Toshio Ito.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.