looks like system only returns true or false if the system call executes
successfully. What if you want to evaluate what's returned from that
perl script?
looks like system only returns true or false if the system call executes successfully. What if you want to evaluate what's returned from that perl script?
looks like system only returns true or false if the system call executes
successfully. What if you want to evaluate what's returned from that
perl script?
IIRC "system" returns the (implementation-dependent) numerical return
code of the call, where by tradition "0" is success and non-zero is an
application-dependent error number. If Ruby is returning "true" on
success and "false" on failure, that's different from what many
environments do.
On Jul 14, 2007, at 9:44 PM, M. Edward (Ed) Borasky wrote:
Dave Coleman wrote:
Tim Hunter wrote:
Check out the system() method.
looks like system only returns true or false if the system call executes
successfully. What if you want to evaluate what's returned from that
perl script?
IIRC "system" returns the (implementation-dependent) numerical return
code of the call, where by tradition "0" is success and non-zero is an
application-dependent error number. If Ruby is returning "true" on
success and "false" on failure, that's different from what many
environments do.
looks like system only returns true or false if the system call executes
successfully. What if you want to evaluate what's returned from that
perl script?
backticks my friend
Thanks, backticks are my friend. The time delay in responding was due to
sorting out the Perl script--my issues a a minor bug in the script which
was quickly fixed.
I want to be able to use Ruby variables in the Perl script. Here's the
command line script:
perl gpsPhoto.pl --dir photos/ --gpsfile GPSTrackWithTime.gpx
--timeoffset )
I can hard code the location of the gpsPhoto.pl, dir, etc, but I want to
use Ruby variables, e.g.
There is also Kernel.`` which will return stdout. If you're looking for something more powerful still look at popen, Open3, or (best of all ;D) the Open4 gem.
Corey
···
On Jul 14, 2007, at 9:12 PM, James Edward Gray II wrote:
On Jul 14, 2007, at 9:44 PM, M. Edward (Ed) Borasky wrote:
Dave Coleman wrote:
Tim Hunter wrote:
Check out the system() method.
looks like system only returns true or false if the system call executes
successfully. What if you want to evaluate what's returned from that
perl script?
IIRC "system" returns the (implementation-dependent) numerical return
code of the call, where by tradition "0" is success and non-zero is an
application-dependent error number. If Ruby is returning "true" on
success and "false" on failure, that's different from what many
environments do.
All the double quotes are needed because the file names have spaces in
them, and gpxFiles is a list of file names with a space in between each
item. Rather ugly solution. Open to suggestions on getting a string list
from an array with double quotes around each item and a space between
each item.
But it's working I think. I need to exercise it some to make sure.
(no, I don't actually recommend this approach--it is just funny)
···
On Jul 22, 2007, at 23:16 , 12 34 wrote:
I want to be able to use Ruby variables in the Perl script. Here's the
command line script:
perl gpsPhoto.pl --dir photos/ --gpsfile GPSTrackWithTime.gpx
--timeoffset )
Thanks to all. You've given me things to look at. And fortunately I
don't have to interact with the script, nor do I need a response. There
is some information I'd like back, but I'm not sure without reading up
on it whether the script supplies the information.
All the double quotes are needed because the file names have spaces in
them, and gpxFiles is a list of file names with a space in between each
item. Rather ugly solution.
class String
# Transforms this string into an escaped POSIX shell argument.
def shell_escape
inspect.gsub(/\\(\d{3})/) {$1.to_i(8).chr}
end
end
Open to suggestions on getting a string list
from an array with double quotes around each item and a space between
each item.
I've been waiting for months for any information on how to use Perl
modules from within Ruby (I'm trying to convince my employer to use Ruby
but they won't consider it unless Ruby can leverage their existing Perl
modules for the time being).
Could you please tell us more about your Perl handler? I don't see it
listed in the Zen Spider Software website.
I've been waiting for months for any information on how to use Perl
modules from within Ruby (I'm trying to convince my employer to use Ruby
but they won't consider it unless Ruby can leverage their existing Perl
modules for the time being).
You can always use RSpec to leverage Ruby into almost any situation.
I'm trying to convince my employer to use Ruby but they won't consider
it unless Ruby can leverage their existing Perl modules for the time being
You can always use RSpec to leverage Ruby into almost any situation.
RSpec is indeed a tasty treat. However, change is not driven by
external temptation alone; it also requires internal effort. In other
words, it is as the Buddha once said: "first intention, then
enlightenment".