NAME

VcsTools::Process - Perl class to handle child process (blocking mode)

SYNOPSIS

my $p = VcsTools::Process -> new (
                                  command => 'll',
                                  workDir => $ENV{'PWD'}
                                 ) ;

$p->pipe (callback=> \&treatStdout) ;

my $s = VcsTools::Process -> new (command => 'bc') ;

$s->pipeIn (input => "3+4+2\nquit\n", callback=> \&treatStdout)}) ;

DESCRIPTION

This class is used to launch child process pipes. When the process is over, the callback function is called with the content of the STDOUT of the child process.

Constructor

new(command => shell_command, [ workDir => a_dir ],[ expect => int ])

Since the pipe and pipeIn function are based on opening a pipe, the invoked shell command must use the STDOUT.

Use 'expect' parameter if the shell command does not return '0' on normal cases.

You can set a 'trace' parameter to help debugging.

Methods

pipe('callback' => sub {})

Will run the command passed to the constructor.

pipeIn('callback' => sub {}, 'input' => a_string )

Will run the command passed to the constructor and will feed the 'input' string to the STDIN of the subprocess.

CALLBACK

Callbacks will get 2 parameters :

  • A boolean result, 1 in case of success, 0 in case of failure.

  • A array ref of all lines retrieved from the STDOUT.

AUTHOR

Dominique Dumont, Dominique_Dumont@grenoble.hp.com

Copyright (c) 1998 Dominique Dumont. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1), Tk(3), Puppet::Any(3), VcsTools::DataSpec::HpTnd(3), VcsTools::Version(3)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 110:

You forgot a '=back' before '=head1'