こういうのを vim の保存時に引っかけてたんですね。
.aurc のレイアウト
1行目:user_name@hostname
2行目:/path/to/identity_file
3行目:リモートホストでのプロジェクトルート
aurc.pl
#!/usr/bin/perl
use strict;
my $target_file = shift @ARGV;
my $command = shift @ARGV;
$command or $command = 'UP';
if ( $target_file =~ /\.pl$|\.cgi$/ ) {
my $result = `perl -c $target_file 2>&1`;
print $result;
$result =~ /syntax ok/i or exit(0);
}
elsif ( $target_file =~ /\.php$|\.phtml$/ ) {
my $result = `php -l $target_file 2>&1`;
print $result;
$result =~ /no syntax error/i or
exit(0);
}
my $tmp = $target_file;
my $host = '';
my $identity = '';
my $local_root = '';
my $remote_root = '';
while ( $tmp =~ s#/[^/]+$## ){
opendir DIR, $tmp;
while ( my $fn = readdir ( DIR ) ){
$fn eq '.aurc' or next;
$local_root = $tmp;
open F, $tmp . '/' . $fn;
( $host, $identity, $remote_root ) = <F>;
chomp $host;
chomp $identity;
chomp $remote_root;
last;
}
close DIR;
$remote_root and last;
}
$remote_root or die 'not found .aurc';
my $remote_file = $target_file;
$remote_file =~ s#$local_root##e;
$remote_root =~ s#/$##;
$remote_file =~ s#^/##;
$remote_file = $remote_root . '/' .$remote_file;
my $cmd = 'sftp ';
$identity and $cmd .= ' -oIdentityFile="' . $identity . '" ';
$cmd .= $host;
open SFTP, '| ' . $cmd;
if ( $command eq 'UP' ) { print SFTP 'put "' . $target_file . '" "' . $remote_file . '"' . "\n"; }
else { print SFTP 'get "' . $remote_file. '" "' . $target_file . '"' . "\n"; }
print SFTP "quit\n";
close SFTP;