Better hashbang when perl is not in /usr/bin
authorRicardo Mones <ricardo@mones.org>
Fri, 4 Jan 2019 16:42:01 +0000 (17:42 +0100)
committerRicardo Mones <ricardo@mones.org>
Fri, 4 Jan 2019 16:42:01 +0000 (17:42 +0100)
Thanks H.Merijn Brand for suggesting this!

Makefile
clawsker

index 9a807b5..98edc9b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,11 @@ all: build
 
 build: ${NAME}.1
        -mkdir build
-       sed -e "s,@PREFIX@,${PREFIX},;s,@LIBDIR@,${LIBDIR},;s,@VERSION@,${VERSION},;s,@DATADIR@,${DATADIR}," < ${NAME} > build/${NAME}
+       perl -MConfig -p -e'1..1 and s/.*/$$Config{startperl}/;' \
+               -e's,\@PREFIX\@,${PREFIX},;' \
+               -e's,\@LIBDIR\@,${LIBDIR},;' \
+               -e's,\@VERSION\@,${VERSION},;' \
+               -e's,\@DATADIR\@,${DATADIR},' ${NAME} > build/${NAME}
        cp -p $< build/$<
        ${MAKE} -C po build
 
index 7ccb942..210f284 100755 (executable)
--- a/clawsker
+++ b/clawsker
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # Clawsker :: A Claws Mail Tweaker
 # Copyright 2007-2018 Ricardo Mones <ricardo@mones.org>
@@ -14,6 +14,7 @@
 package Clawsker;
 use 5.010_000;
 use strict;
+use warnings;
 use utf8;
 use version 0.77;
 use Glib qw(TRUE FALSE);