File: install-perl-script.pl

package info (click to toggle)
dkimproxy 1.2-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 536 kB
  • ctags: 55
  • sloc: perl: 1,307; sh: 923; makefile: 113
file content (34 lines) | stat: -rwxr-xr-x 692 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#-PERL

use strict;
use warnings;

my $INCLUDE = $ENV{"PERL_INCLUDE"};
my $PERL = $ENV{"PERL"};

die "missing PERL environment variable"
	unless ($PERL);
die "missing PERL_INCLUDE environment variable"
	unless ($INCLUDE);

die "wrong number of arguments\n"
	unless (@ARGV == 2);

my $source_filename = $ARGV[0];
my $dest_filename = $ARGV[1];

open my $source_fh, "<", $source_filename
	or die "can't read $source_filename: $!\n";

open my $dest_fh, ">", $dest_filename
	or die "can't write to $dest_filename: $!\n";

print $dest_fh "#!$PERL -I$INCLUDE\n";

while (my $line = <$source_fh>)
{
	next if ($line =~ m/^#!.*\/perl\b/);
	next if ($line =~ m/^use lib "\./);

	print $dest_fh $line;
}