perl 执行一个系统命令(svn info),发一封邮件

7/29/2010 1:47:00 PM

perl 执行一个系统命令(svn info),发一封邮件
 
use.NET::SMTP;
system("svn info http://x.x.x.x>>num1");
open (FILE1,"num1")||die "Couldn't open num1";
$num1=<FILE1>;#print $num1;
$num2=<FILE1>;#print $num2;
$num3=<FILE1>;#print $num3;
$num4=<FILE1>;#print $num4;
$num5=<FILE1>;#print $num5;
$num6=<FILE1>;#print $num6;
my ($name,$a) = splIT(//:/, $num5);
system("svn info http://x.x.x.x>>num2");
open (FILE2,"num2")||die "Couldn't open num2";
$num1=<FILE2>;#print $num1;
$num2=<FILE2>;#print $num2;
$num3=<FILE2>;#print $num3;
$num4=<FILE2>;#print $num4;
$num5=<FILE2>;#print $num5;
$num6=<FILE2>;#print $num6;
my ($name,$b) = split(//:/, $num5);
if (1){
notify();
close FILE1;
close FILE2;
}
sub notify()
{
    my $subject = subvision;
    my $message = "Currently local subversion number is $a Currently Remote subversion number is $b";
    my $mailhost = mial server name;
   
    $smtp = Net::SMTP->new($mailhost);
   
    #$mailto is recipient of the email
    $mailto = " x@x.x.x";
    #$mailfrom is sender of the email
    $mailfrom = " x@x.x.x";
    $smtp->mail($mailfrom) or $emailstatus = 0;
    $smtp->to($mailto, $mailcc)  or $emailstatus = 0;
    $smtp->data()  or $emailstatus = 0;
    $smtp->datasend("From: $mailfrom/n")  or $emailstatus = 0;
    $smtp->datasend("To: $mailto/n")  or $emailstatus = 0;
    $smtp->datasend("Cc: $mailcc/n")  or $emailstatus = 0;
    $smtp->datasend("Subject: $subject/n")  or $emailstatus = 0;
    $smtp->datasend("/n")  or $emailstatus = 0;
    $smtp->datasend("$message/n/n")  or $emailstatus = 0;
    $smtp->datasend()  or $emailstatus = 0;
    $smtp->quit()  or  $emailstatus = 0;
}
unlink num1;
unlink num2;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值