修改部分設(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);
返回
栾川县| 庆城县| 沛县| 成安县| 始兴县| 蒙城县| 秦皇岛市| 祥云县| 广安市| 泊头市| 泰和县| 富民县| 库伦旗| 伊川县| 高要市| 乌鲁木齐市| 大同县| 腾冲县| 哈巴河县| 上栗县| 保康县| 丹棱县| 尼玛县| 峨边| 新晃| 哈密市| 霍州市| 安国市| 沁源县| 沙河市| 丰原市| 大港区| 阜平县| 开远市| 大名县| 永昌县| 彰化市| 南江县| 丰顺县| 弋阳县| 青冈县|