Title:HowtooverloadmodulewithoutmodifyingitinPerlKeyword:PerlmoduleoverloaddebuguserequiredifferenceunshiftINCTodebugaPerlscript,Imustaddsometracecodeinit.Thereare2filestobemodified.Oneismainplscript,anotherispmmodulefile.Iamnotallowedtomodifythemdirectly.Also,Idon’twanttoduplicatethewholeenvironmentbecauseit’sverybig.So,Icreateaworkingdirectoryandcopythose2files.Keepthedirectoryasoriginalstructure.originalstructureis/system/bin/thescript.pl/system/modules/package/TheModule.pm…myworkingdirectoryis/myworkarea/bin/thescript.pl/myworkarea/modules/package/TheModule.pmAftermodifiedmyTheModule.pm,Imustmakethethescript.pltoloadmymoduleinsteadoforiginalone.Thecodeinthescript.plaboutloadingmoduleis#!/somepathtoperl/bin/perluseFindBinqw($Bin);uselibqq{$Bin/../modules};usepackage::TheModule;…my$theModule=newpackage::TheModule;…Changeitas#!/somepathtoperl/bin/perluseFindBinqw($Bin);uselibqq{/system/modules};unshift(@INC,”$Bin/../modules”);requirepackage::TheModule;…my$theModule=newpackage::TheModule;…Then,thethescript.plwillcallthe/myworkarea/modules/package/TheModule.pm.Also,itcanuseothermodulesin/system/modules1.Purposeofunshiftuselibqq{/system/modules};unshift(@INC,”$Bin/../modules”);addoriginalpathintoINC,thenuseunshifttoaddthenewmodulesdirectoryatthebeginingoftheINC.2.Purposeofrequirerequirepackage::TheModule;tomaketheTheModuleloadatruntime.Thedifferencebetweenuseandrequireishere.http://www.geekinterview.com/question_details/17064标题:在Perl中如何让新代码取代原有代码关键部分:1.用unshift把包含新模块的路径放在INC的最前面2.用require取代use让模块在运行时加载Reference:http://www.cbi.pku.edu.cn/chinese/documents/perl/perl14.htmReference:http://www.geekinterview.com/question_details/17064
月度归档: 2009 年 3 月
vb script里拼字符串的问题
关键字:vbsstringconcatenation今天调试一段vbs程序,原有代码中用加号拼接字符串。我想在日志信息里显示一个数值型的值,发现用加号拼接后,日志出不来。改用&号之后正常。这里有一篇关于vbs拼接字符串的文章http://www.asp101.com/articles/marcus/concatenation/default.asp
eclipse语法高亮插件
关键字:eclipsesyntaxcoloringplugin已经eclipse习惯用eclipse作为文本编辑器。默认eclipse3.3是不支持shellscript,vbscript和perlscript等的语法高亮。在google上用上面的关键字,搜到了几个提供这个功能的插件。试了一下”coloreditor:syntaxcoloringforeclipse”感觉不错,推荐一下。插件网址在http://gstaff.org/colorEditor/下载页面http://gstaff.org/colorEditor/download.htmleclipse3.1以上的版本,只要下载之后拷贝到eclipse的plugin目录下重启eclipse即可Installationissimple.DropthejarintoyourEclipsepluginsdirectory.(Noneedtounzipifyou’reusing>Eclise3.1).Forexamplec:/apps/eclipse/plugins.RestartEclipse,onceEclipseisrestartedyoushouldbeabletousethecolorEditorbyselectingafile.IfthereisalreadyadefaulteditorforthefileyouwouldliketoedityoucanrightmouseclickandchooseOpenWith|SyntaxColoringEditor重启之后,eclipse里右键点它支持的文件,例如*.sh文件,会有OpenWith|SyntaxColoringEditor选项。还可以到菜单Window->Preferences->General->Editors->FileAssociations里设置。它支持的类型挺多。不方便抓图,大家可以到它的网站上去看截图http://gstaff.org/colorEditor/screenshots.html
七龙珠
活终于干完了。几个月来第一次觉得可以放松了。也有时间重新泡网络了。前两天看了电影七龙珠,实在烂得可以。其实看之前就已经猜到了,不过考虑毕竟是七龙珠,毕竟有周润发,所以还是看了。西方人拍东方人的故事在东方人眼里看起来总是那么奇怪。整个片子除了角色的名字,其它东西让人感觉不出来是七龙珠。帅哥,美女,故事,场面,动作,特效,要啥没啥。看了很不爽,只能在这里发一顿牢骚。