修改部分設(shè)定參數(shù)程序

返回

# 復制軟件時,修改部分設(shè)定參數(shù)的程序 use strict; use File::Copy; my($aref); # 處理mscenq2.pl $$aref{inputfile} = 'mscenq2.pl'; ($aref) = change_words($aref); # 處理mscquo2.pl $$aref{inputfile} = 'mscquo2.pl'; ($aref) = change_words($aref); # 處理order1.pl $$aref{inputfile} = 'mscorder1.pl'; ($aref) = change_words($aref); # 處理order2.pl $$aref{inputfile} = 'mscorder2.pl'; ($aref) = change_words($aref); # 處理packing.pl $$aref{inputfile} = 'mscpacking.pl'; ($aref) = change_words($aref); # 處理inv1.pl $$aref{inputfile} = 'mscinv1.pl'; ($aref) = change_words($aref); # 處理inv2.pl $$aref{inputfile} = 'mscinv2.pl'; ($aref) = change_words($aref); sub change_words { my($aref) = @_; my(%t); print "inputfile==>$$aref{inputfile}\n"; $t{oldfile} = $$aref{inputfile} . '.tmp.pl'; copy("./pro/$$aref{inputfile}","./pro/$t{oldfile}") or die "Copy failed:$!"; open(IN,"./pro/$t{oldfile}") or die "Can't open the file $t{oldfile}.\n"; open(OUT,">./pro/$$aref{inputfile}"); while(<IN>){ if ( $_ =~ /Open\(\"C/ ) { $_ =~ s/Open\(\"C/Open\(\"E/; print $_; print OUT $_; } elsif ( $_ =~ /SaveAs\(\"C/ ) { $_ =~ s/SaveAs\(\"C/SaveAs\(\"E/; print $_; print OUT $_; } else { print OUT $_; } } close(IN); close(OUT); return($aref); } # 處理msc.pm copy("msc.pm","msc1.pm") or die "Copy failed:$!"; open(IN,"msc1.pm") or die "Can't open the file msc1.pm.\n"; open(OUT,">msc.pm"); while(<IN>){ if ( $_ =~ /localhost/ ) { $_ =~ s/localhost/SERVER\.msc\.local/; $_ =~ s/cookbook/msc/; $_ =~ s/cbuser/cb2user/; $_ =~ s/cbpass/cb2pass/; print OUT $_; } else { print OUT $_; } } close(IN); close(OUT);
返回
青冈县| 休宁县| 德格县| 卢龙县| 福贡县| 灵武市| 河南省| 拜城县| 藁城市| 阳信县| 平昌县| 伊金霍洛旗| 盐池县| 工布江达县| 阿克| 罗江县| 平邑县| 句容市| 图片| 且末县| 雅江县| 莆田市| 万荣县| 长宁县| 乐平市| 河东区| 慈利县| 额尔古纳市| 揭东县| 敖汉旗| 宜昌市| 靖州| 临澧县| 呈贡县| 灵寿县| 金山区| 泸定县| 弥渡县| 临西县| 淮滨县| 桑植县|