bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: Execing perl?


From: William Bloom
Subject: Re[2]: Execing perl?
Date: Wed, 11 Jul 2001 12:53:46 -0700 (MST)

The 'real' answer to the question is admittedly not entirely
appropriate to this list, so I'll be brief.

Trying to build and distribute Perl scripts without
knowledge of the target system's real Perl path is a problem
that Perl package developers have met and, happily, dealt
with already.  Grab almost any Perl package from
ftp.cpan.org, unarchive it, study the Makefile.PL (whose
contents follow a standard convention), and you'll see how
it's done.  Perusing other Perl POD pages on the modules you
see mentioned, as well as gazing at some examples, will
allow to see how to use this.  A perl package built for
distribution using this technique works, in short, by simply
automatically editing the script to have the Perl path that
is correct for the -local- host before installing it to it's
target directory (this happens during the make). Rather than
copying the script to a machine, one simply copies the
package instead and uses a 'make' from within the package
working directory (the directory may be removed afterwards,
if unneeded).

We have many different platforms at this company, with Perl
paths gosh-knows-where.  Much like your own problem.  We
learned how to use the standard Perl packaging technique,
though, and have never again been frustrated by platform
idiosyncracies since.  The procedure may seem burdensome at
first blush, and there is of course a little investment of
time at the beginning in order to learn how to put together
a package for your script, but after having gone through the
exercise I can tell you that it was straightforward and
worthwhile.

A pardon is politely asked from list readers for my having
mentioned this in this list, but I've heard questions like
this several times from people who also have struggled with
how to distribute Perl scripts, and it may well sometimes be
seen as a shell (i.e. BASH) problem when it isn't really.


Bill

On Wed, 11 Jul 2001 15:17:37 -0400 Paul D. Smith <Paul D. Smith 
<pausmith@nortelnetworks.com>> wrote:

> %% prj@po.cwru.edu (Paul Jarc) writes:
> 
>   pj> This will break *any* interpreter, as long as it's on Linux.  Linux
>   pj> passes everything after the first space as a single argument to the
>   pj> interpreter.
> 
> Doh!
> 
>   pj> The eval stuff isn't what you want anyway, and I don't
>   pj> think it ought to be used that way in the perlrun man page.  It's
>   pj> meant to be used like this:
>   pj>   #!/path/to/perl
>   pj>   eval 'exec perl -wS $0 ${1+"$@"}'
>   pj>     if $running_under_some_shell;
> 
> This can't work for me.
> 
> My entire goal is to invoke Perl when I don't know the path.  I have
> lots of different systems, with different OS's on them, and Perl is
> installed on different places on each of them.  I want to run the same
> script on all of them.
> 
> If you use an invalid path in the #! commandline, then it just fails.
> 
>   pj> The next example in the perlrun man page is what you want:
>   pj> #!/usr/bin/env perl
>   pj> This assumes a location for env, but searches for perl in $PATH.
> 
> I saw that; I don't want to assume a location for env, either.
> 
> 
> How frustrating!  Other interpreters all have straightforward ways of
> doing this.
> 
> Perl is getting too fancy for its own britches, with this special
> attempt to emulate sh-bang processing if the word "perl" doesn't appear
> on the first line :-/.  At the least there should be a way to disable
> that.
> 
> -- 
> -------------------------------------------------------------------------------
>  Paul D. Smith <psmith@baynetworks.com>    HASMAT--HA Software Methods & Tools
>  "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
> -------------------------------------------------------------------------------
>    These are my opinions---Nortel Networks takes no responsibility for them.
> 
> _______________________________________________
> Bug-bash mailing list
> Bug-bash@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-bash


--
William Bloom <william.bloom@pegs.com> (602) 906-7525
Pegasus Solutions, Inc.  7500 North Dreamy Draw Drive, Suite 120
Phoenix, Az 85020  http://www.pegs.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]