Thomas Adam <[email protected]> writes:

> On Fri, Apr 29, 2011 at 12:14:06PM -0400, [email protected] wrote:
>> [email protected] writes:
>> 
>> > CVSROOT:   /home/cvs/fvwm
>> > Module name:       fvwm
>> > Changes by:        tadam   11/04/29 07:05:50
>> >
>> > Modified files:
>> >    bin            : Tag: branch-2_6 ChangeLog fvwm-menu-desktop.in 
>> >
>> > Log message:
>> > Remove hard-coded #! line from fvwm-menu-desktop
>> >
>> > @PERL@ always interpolates out to the correct interpreter.
>> 
>> Yeah, I know.
>> 
>> I stuck that in there for testing purposes.
>> 
>> (Yep I sometimes test before commit. :) )
>
> Nah -- that's overrated.  :)
>
>> I simply forgot to remove it.
>> 
>> If you notice I stick my test line at the bottom of the file
>> for Emacs:
>> 
>> # Local Variables:
>> # mode: cperl
>> # compile-command: "perl fvwm-menu-desktop.in --enable-mini-icons 
>> --fvwm-icons"
>> # End:
>> 
>> So, at first I thought if I fed the file to the perl interpreter nothing
>> would get in the way and I could test the file directly.  But I get:
>> 
>> perl fvwm-menu-desktop.in --enable-mini-icons --fvwm-icons
>> Can't exec @PERL@ at fvwm-menu-desktop.in line 1.
>> 
>> Just reviewed "man perlrun".  If there's a solution, it isn't
>> obvious to me.
>
> It's because perl treats #! specifically as special as the first line in a
> file, and the first line is:
>
> #!@PERL@
>
> There's plenty of examples of this in other perl scripts in FVWM.  We could
> just use "env", but there's some distributions which have it in either /bin
> or /usr/bin.
>
> Instead, I just tend to do this:
>
> cd fvwm/bin
> rm fvw-menu-directory ; make
>
> Which does nothing more than interpolate out #!@PERL@ in this case, but I
> still find it a useful step when debugging.  :)

Drives me nuts.

Since I'm using Emacs,
when the script contains a syntax error, I want to hit "next-error" to
access the line in error.  If I do a make and run the interpreted
script,  Then Emacs opens up the interpreted file.  Leading to all kinds
of interesting results.

When I put my first piece of Perl into Fvwm, I used the "env" trick
to bootstrap Perl.  The distro maintainers didn't like that one bit.
Not that I'm blaming them.

Ah, just found a solution.

I put a soft link in the source tree for @PERL@ to /usr/bin/perl.

Reply via email to