install
changeset 26 b9c8d2fed9b7
parent 25 519fca1ac4d5
equal deleted inserted replaced
25:519fca1ac4d5 26:b9c8d2fed9b7
     1 #! /usr/bin/perl
       
     2 
       
     3 use 5.010;
       
     4 use strict;
       
     5 use warnings;
       
     6 
       
     7 die "$0: need filenames to install\n" if not @ARGV;
       
     8 
       
     9 install($_) foreach @ARGV;
       
    10 
       
    11 sub install {
       
    12     my $file = shift;
       
    13 
       
    14     local @ARGV = ($file);
       
    15     my $destination = (map { /->\s*(\S+)/ } grep { /# ->/ } <>)[0];
       
    16 
       
    17     die "No destination for $file\n" if not $destination;
       
    18     say "$file => $destination";
       
    19 
       
    20     system("scp", $file => $destination);
       
    21     die if $?;
       
    22     
       
    23 }