File: install.pm

package info (click to toggle)
perl-tk 1%3A800.024-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 18,528 kB
  • ctags: 19,152
  • sloc: ansic: 206,767; perl: 40,255; makefile: 4,370; sh: 2,290; yacc: 762
file content (37 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (2)
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
35
36
37
package Tk::install;
require Exporter;

use vars qw($VERSION @EXPORT);
$VERSION = '3.012'; # $Id: //depot/Tk8/Tk/install.pm#12 $

use base  qw(Exporter);
@EXPORT = qw(installbin);

use Config;

sub installbin
{
 my $prog  = shift(@ARGV);
 my $start = $Config{'startperl'};
 my $perl  = $Config{'perl'} || 'perl';
 $start =~ s/$perl$/$prog/;
 while (($src,$dst) = splice(@ARGV,0,2))
  {
   open(SRC,"<$src") || die "Cannot open $src:$!";
   my $line = <SRC>;
   $line =~ s/^#!\s*\S+/$start/;
   warn $line;
   chmod(0755,$dst) if (-f $dst);
   open(DST,">$dst") || die "Cannot open $dst:$!";
   print "installbin $src => $dst\n";
   do
    {
     print DST $line;
    } while (defined($line = <SRC>));
   close(SRC);
   close(DST);
   chmod(0555,$dst);
  }
}

1;