tzenes
tzenes

Reputation: 1709

Can I use Proc::Reliable on windows?

I'm using ActivePerl on a Win 7 box and I want to use the Proc::Reliable CPAN module. It downloaded and installed properly but when I tried to run the following code, it failed at run

my $newProc = Proc::Reliable->new()
$newProc->run("perl.exe -e print 'hello world'");

I tried a couple things, such as testing the status and trying to retrieve output, but with no luck. As best as I can tell, the program dies silently on run.

For reference perl.exe is in my PATH variable and I'm calling this from commandline as: perl.exe test.pl

Upvotes: 0

Views: 220

Answers (3)

Vess
Vess

Reputation: 117

I have contacted the author of the Proc::Reliable module and he confirmed that the module does not work on Windows.

Upvotes: 2

mob
mob

Reputation: 118665

Quoting is a little different in the Windows "shell". To get your mini-program to be interpreted as a single argument, try something like

perl.exe -e "print qq/hello world/"

Upvotes: 3

ysth
ysth

Reputation: 98398

It probably isn't failing. -e print 'hello world' tells perl to execute the code print with @ARGV set to hello world (or perhaps ("'hello","world'"), I forgot how windows cmd quoting handles ''). This prints the contents of $_ (that is, undef) to STDOUT.

Always use warnings. Even on one-liners. Perhaps especially on one-liners. Compare:

$ perl -e print 'hello world'
$

and

$ perl -we print 'hello world'
Use of uninitialized value $_ in print at -e line 1.
$

Upvotes: 4

Related Questions