On Tue, 10 Jun 2003, Alan Burlison wrote:

> However, I've thought of a nasty hack: stick a '#' character before the \ -
> that way perl will ignore it:
>
> broke:
>          @perl -le 'eval {print "First line."} \
>          or print  "Second line.";'
> ok:
>          @perl -le 'eval {print "First line."} #\
>          or print  "Second line.";'
>
> $ make broke
> Backslash found where operator expected at -e line 1, near "} \"
>          (Missing operator before  \?)
> syntax error at -e line 1, near "} \"
> Execution of -e aborted due to compilation errors.
> *** Error code 255
> make: Fatal error: Command failed for target `broke'
>
> $ make ok
> First line.
>
> However this will only work if you know the command that will be executed is
> perl!

It will also only work with Sun's make.  GNU make or BSD make will fold
those two lines into one, strip the trailing '\', and present perl with
           @perl -le 'eval {print "First line."} # or print  "Second line.";'
which won't work.

> The other alternative is just not to try to wrap lines - on Solaris at least
> ARG_MAX is 1048320.

Yup, this is probably the way to go.  With GNU make it's getting all
squashed onto one line anyway.  The remaining issues might be the
resulting line length if you want to edit (or even just *read*) the
resulting Makefile, and any line-length limits built into make.  In the
context of MM_Unix.pm, for perl one-liners, it's probably safe to just not
bother escaping the newlines.

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to