On Jul 14, 2006, at 10:41 PM, Just Another Victim of the Ambient  
Morality wrote:

> "Eric Hodel" <drbrain / segment7.net> wrote in message
> news:D50A04D4-B38E-433D-8C47-38AC2E67C079 / segment7.net...
>> On Jul 14, 2006, at 6:55 PM, Just Another Victim of the Ambient  
>> Morality wrote:
>
>>> I tried to call a PERL script from a Ruby script and that  
>>> myseriously
>>> failed.  I did a search on groups.google and found that you need  
>>> to  call
>>> the PERL interpreter, directly.  I found this a little odd  since  
>>> PERL
>>> scripts have no problem calling other PERL scripts.   It's not a  
>>> problem
>>> of the environment, since Ruby can call  executables in the  
>>> execution
>>> path.
>>
>> I don't believe you.  Please show us an error.
>>
>> $ cat x.pl
>> #!/usr/bin/env perl
>>
>> print "hi\n";
>>
>> $ ruby -e 'system "./x.pl"'
>> hi
>
> Interestingly enough, I remember seeing this on the other post in  
> this  newsgroup.  This is what this scenario looks like for me:
>
> $cat x.pl
> print "hi\n"
>
> $ruby -e 'puts `x.pl`'
> -e:1:in ``': Exec format error - x.pl (Errno::ENOEXEC)
>     from -e:1
>
>
> Of course, in DOS, the command line uses the ">" symbol but I  
> didn't want to create any confusion with quoted text.  Of course,  
> the solution was to use the "system" method but, really, what's so  
> different with the familiar `` operator?

Are you sure it worked with system?

try:

$ ruby -e 'p system("./x.pl")'

You should see a hi and a true printed, something like this:

hi
true

The differences between ` and system shouldn't be important for  
getting this to work, I think Windows needs to know how to run .pl  
files for this to work.

> ...Yet you didn't know this nor did you use it in your example.   
> This suggests to me that you don't use this operator anymore.  Why  
> not?

I could have used `, but chose not to.  I use ` when I need to  
capture stdout.

> The "system" call doesn't even return the output of the command nor  
> does this output actually reach stdout...

Well, it may not be running at all and returning false.

Do you have Windows mapping the perl interpreter to .pl files?  What  
happens when you double-click a .pl file from explorer?

A Windows expert may need to help you on this problem.  Ruby just  
asks the OS to run these things, so if the OS can't figure out what  
to do with it Ruby won't be able to either. :(

-- 
Eric Hodel - drbrain / segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com