--UlVJffcvxoiEqYs2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Mar 08, 2006 at 11:00:42PM +0900, Nick Snels wrote:
> Hi,
>=20
> I have a very basic Perl script (calls a nice CPAN library not available=
=20
> in Ruby) that prints it output to the screen. In Ruby I call it like:
>=20
> sql =3D `vendor\\sql\\sql.pl "#{@question.sql}"`
>=20
> But I get the following error
>=20
> Errno::ENOEXEC in Question#create
> Exec format error - vendor\converters\sql\sql.pl "select * from=20
> cdcol.cds"
>=20
> When I call it from DOS it works perfectly. How can I fix this? And is=20
> there an alternative for using ` (backquotes)? Thanks for the help.
>=20

IO.popen is one way to go. Here's a quick example...

ls =3D IO.popen("ls -ltr", "r")
puts ls.readlines

Kernel.exec should be the same as using the backquotes.  If you need
something more robust, take a look at Open3.

Steve Peters
steve / fisharerojo.org

--UlVJffcvxoiEqYs2
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)

iD8DBQFEDvGz9T8SSoPkrKIRAkw/AJ9SkKq6IaFXi/x0BHtvhoLczXkPEgCeP/FJ
V0WTXwIjxYfcf6/gScHlXWM=
=wiMb
-----END PGP SIGNATURE-----

--UlVJffcvxoiEqYs2--

On Wed, Mar 08, 2006 at 11:00:42PM +0900, Nick Snels wrote:
> Hi,
>=20
> I have a very basic Perl script (calls a nice CPAN library not available=
=20
> in Ruby) that prints it output to the screen. In Ruby I call it like:
>=20
> sql =3D `vendor\\sql\\sql.pl "#{@question.sql}"`
>=20
> But I get the following error
>=20
> Errno::ENOEXEC in Question#create
> Exec format error - vendor\converters\sql\sql.pl "select * from=20
> cdcol.cds"
>=20
> When I call it from DOS it works perfectly. How can I fix this? And is=20
> there an alternative for using ` (backquotes)? Thanks for the help.
>=20

IO.popen is one way to go. Here's a quick example...

ls =3D IO.popen("ls -ltr", "r")
puts ls.readlines

Kernel.exec should be the same as using the backquotes.  If you need
something more robust, take a look at Open3.

Steve Peters
steve / fisharerojo.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)

iD8DBQFEDvGz9T8SSoPkrKIRAkw/AJ9SkKq6IaFXi/x0BHtvhoLczXkPEgCeP/FJ
V0WTXwIjxYfcf6/gScHlXWM=
=wiMb
-----END PGP SIGNATURE-----