On Mon, Mar 08, 2010 at 04:32:35PM +0100, Eric Veith1 wrote:
> YAPH <yet.another.perl.hac...@gmail.com> wrote on 03/05/2010 06:57:19 PM:
> > It was the shell construc,  eval '....' if 0; (Will this ever
> > execute?)
> > 
> > and the
> > 
> > exec /bin/perl $0 ${1+"$@"};
> > 
> > that threw me off.
> 
> YAPH:
> 
> Actually, the first constructs gets read and interpreted by both shell and 
> perl. However, Perl doesn't execute it because of the "if 0" part, which 
> the shell, in turn, never reads because of the "exec" within the eval'd 
> string. It's actually pretty smart, but unnecessary since there easier 
> ways.

I don't imagine there are many easier ways which actually work, since
those environment variables need to be set before perl starts.

So if you want to keep it all in one Perl file you'll need to check the
variables and if they are not as you want them you'll need to set them
and exec yourself.  That's probably not easier.

Or you'll need to have two files, one shell and the other perl and call
the perl from the shell.  I'm not sure I'd call that easier.

Or you'll need to ensure your environment is set up as it should be in
some other way.  That's probably not easier either.

But I suppose it all hinges on what one considers easier ...

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to