⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 share.pm

📁 有较多的东西
💻 PM
字号:
#!/usr/bin/perl -w# --------------------------------------------------------- ##                                                           ##             The iFlytek EasyTraining Toolkit              ##                                                           ## --------------------------------------------------------- ##          Copyright(c) iFlytek Corporation, 2006           ##                    Hefei, Anhui, PRC                      ##                 http://www.iflytek.com                    ## --------------------------------------------------------- ##         File: share.pm: Global function defination        ##                   Author: Zhi-Jie Yan                     ## ----------------------------------------------------------#use strict;package share;sub ::MakeDirIfNotExist{    my ($strPathname) = @_;        if(!-e $strPathname)    {        mkdir $strPathname, 0755 || die "ERROR: Cannot make directory $strPathname: $!\n";    }}sub ::RunOrDie{    my ($cmd, $donefile) = @_;    my $localcmd;        my $time = localtime();    printf("=== $time ===\n");    $cmd =~ s/\s+/ /g;    printf "$cmd\n\n";    if($cmd eq "")    {        $localcmd = "echo done > $donefile";        if(system($localcmd) != 0)        {            die "ERROR: Cannot dump done file: $donefile";        }    }    elsif(system($cmd) == 0)    {        if($donefile ne "")            {            $localcmd = "echo done > $donefile";            if(system($localcmd) != 0)            {                die "ERROR: Cannot dump done file: $donefile";            }        }    }    else    {        die "ERROR: Execute command failed: $?";    }}sub ::RunOrDieDTM{    my ($cmd, $jobname, $logfile) = @_;    my $localcmd;        my $time = localtime();    printf("=== $time ===\n");    $cmd =~ s/\s+/ /g;    printf "$cmd\n\n";        $localcmd = "//192.168.76.50/dtm/dtm -r  -j $jobname -l $logfile $cmd";    if(system($localcmd) != 0)    {        die "ERROR: Execute command failed: $?";    }}sub ::AppendFile{    my ($target, $source) = @_;    open(fhSource, "< $source") || die "ERROR: Cannot open $source for reading: $!";    open(fhTarget, ">> $target") || die "ERROR: Cannot open $target for appending: $!";        while(my $line = <fhSource>)    {        print fhTarget $line;    }        close(fhTarget);    close(fhSource);}sub ::CmdDebug{    my ($cmd) = @_;    $cmd =~ s/\s+/ /g;    print($cmd);}sub ::RemoveFileIfExist{    my ($target) = @_;    if(-e $target)    {        unlink $target || die "ERROR: Cannot delete $target: $!";    }}sub ::WaitForJob{    my ($jobname) = @_;    my $localcmd = "//192.168.76.50/dtm/dtm -w $jobname";    if(system($localcmd) != 0)    {        die "ERROR: Execute command failed: $?";    }}1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -