NAME

Process::Launcher - Execute Process objects from the command line

SYNOPSIS

# Create from passed params and run
perl -MProcess::Launcher -e run MyProcessClass param value

# Create from STDIN params and run
perl -MProcess::Launcher -e run3 MyProcessClass

# Thaw via Storable from STDIN, and freeze back after to STDOUT
perl -MProcess::Launcher -e storable

DESCRIPTION

The Process::Launcher module provides a mechanism for launching and running a Process-compatible object from the command line, and returning the results.

FUNCTIONS

All functions are imported into the callers by default.

run

The run function creates an object based on the arguments passed to the program on the command line.

The first param is take as the Process class and loaded, and the rest of the params are passed directly to the constructor.

Note that this does mean you can't pass anything more complex than simple string pairs. If you need something more complex, try the storable function below.

Prints one line of output at the end of the process run.

# Prints the following if the process completed correctly
OK

# Prints the following if the process does not complete
FAIL - reason

run3

The run3 function is similar to the run function but assumes you are launching the process via something that makes it easy to pass in params via STDIN, such as IPC::Run3 (recommended)

It takes a single param of the Process class.

It then readsa series of key-value pairs from STDIN in the form

param1=value
param2=value

At the end of the input, the key/value pairs are passed to the constructor, and from there the function behaves identically to run above, including output.

storable

The storable function is more robust and thorough again.

It reads data from STDIN and then thaws that via Storable.

The data is expected to thaw to an already-constructed Process object that is also a Process::Storable.

This object has prepare and then run called on it.

The same OK or FAIL line will be written as above, but after that first line, the completed object will be frozen via the Storable::nstore_fd function and written to STDOUT as well.

The intent is that you create your process in your main process, and then hand it off to another Perl instance for execution, and then optionally return it to handle the results.

SUPPORT

Bugs should be reported via the CPAN bug tracker at

http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Process

For other issues, contact the author.

AUTHOR

Adam Kennedy <cpan@ali.as>, http://ali.as/

COPYRIGHT

Copyright 2006 Adam Kennedy. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.