亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2727 | 回復(fù): 8
打印 上一主題 下一主題

win下把perl 編譯成exe,如何同時打包原代碼中需要讀入的一個文本 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2012-03-30 08:51 |只看該作者 |倒序?yàn)g覽
perl 編譯成exe,如何加載原代碼中需要讀入的一個文本???

我的意思是
源代碼中 有一個 hash 表
它的內(nèi)容是從當(dāng)前目錄的一個txt文本中讀入的

現(xiàn)在把這個代碼編譯成exe 去執(zhí)行
如何讓exe不需要再去尋找 加載 那個txt文本
而是在編譯的時候一塊打包進(jìn)去

謝謝
求教了

論壇徽章:
0
2 [報告]
發(fā)表于 2012-03-30 09:14 |只看該作者
那就將txt文本里面的東西寫入代碼中的變量

論壇徽章:
0
3 [報告]
發(fā)表于 2012-03-30 09:22 |只看該作者
想了半天
也只能像2樓所說
直接 把文本內(nèi)容 寫到 程序中

我前面想多了,覺得這樣一來代碼好長,以為有別的解決方法呢
謝了

論壇徽章:
0
4 [報告]
發(fā)表于 2012-03-30 09:25 |只看該作者
sncchen 發(fā)表于 2012-03-30 09:22
想了半天
也只能像2樓所說
直接 把文本內(nèi)容 寫到 程序中

帶著那個txt會怎么樣呢- -

論壇徽章:
0
5 [報告]
發(fā)表于 2012-03-30 10:43 |只看該作者
回復(fù) 4# kk861123


    perl 代碼中的一個 hash 是從當(dāng)前目錄的txt讀入的
生成的exe  如果不和txt放在一塊 運(yùn)行 就會執(zhí)行失敗   

論壇徽章:
0
6 [報告]
發(fā)表于 2012-04-01 07:02 |只看該作者
本帖最后由 iamlimeng 于 2012-04-01 08:35 編輯

有辦法的,PDK打包時,允許額外綁定程序運(yùn)行所需資源,比如Icon、數(shù)據(jù),在PerlApp的Fils標(biāo)簽,Bound files中設(shè)置中。

論壇徽章:
0
7 [報告]
發(fā)表于 2012-04-01 08:43 |只看該作者
回復(fù) 6# iamlimeng
這個bind  選項(xiàng)我也注意到了

    --bind file
         List an additional file to include in the application. The
         application can access this file at runtime through the
         "PerlApp::get_bound_file()" and "PerlApp::extract_bound_file()"
         functions. Separate multiple filenames with semicolons. This option
         can be repeated.

         Additional options can be specified after the filename, within
         brackets and separated by commas:

            name[option1,option2,...]

         Valid options are:

         file=filename
             Specifies the filesystem name of the file to be bound. Cannot
             be specified together with "data". If neither "file" nor "data"
             is specified, then the bound "name" is used as the filesystem
             name as well.

         data=*text*
             File contents specified as literal text. Cannot be specified
             together with "file".

         text
             The file will be read in text mode on Windows.

         extract
             The bound file is extracted into the "TEMP" directory upon
             application start. It is deleted when the application
             terminates. The extraction directory is added to the "PATH"
             environment variable (as well as to the "LD_LIBRARY_PATH"
             variable on Unix). It is also added to the front of @INC.

         mode=*file permissions*
             Specifies the access mode for the file when extracted either by
             the "extract" option or the "PerlApp::extract_bound_file()"
             function. File permissions must be specified as an octal number
             (0555 by default); "PerlApp" implicitly calls chmod() after
             extracting the file to make sure it ends up with the right
             permission bits. The "mode=" prefix is optional.

         Examples:

             --bind PerlEz.dll[file=\perl\bin\PerlEz.dll,extract]
             --bind data.txt[text,0777]

         Note: Files bound using the "extract" suboption of "--bind" or
         extracted via "PerlApp::extract_bound_file()" are written to a a
         per-process temporary directory and are automatically deleted when
         the process ends. This occurs regardless of whether the "--clean"
         option is used.

我想的也是 bind 一下就可以了
但試了幾次都失敗,以為是自己對上文理解錯了
有機(jī)會再好好研究一下吧
謝謝你的回復(fù)

論壇徽章:
0
8 [報告]
發(fā)表于 2012-04-01 08:50 |只看該作者
失敗的原因是:未允許啟動程序時自動釋放綁定的文件。將Automatic at startup選項(xiàng)選定,這樣,程序運(yùn)行時,會將綁定的文件臨時釋放到程序的臨時文件夾,以供程序調(diào)用。

但這樣做的風(fēng)險是會泄漏數(shù)據(jù),如果你的數(shù)據(jù)不希望共享給其他人,還是內(nèi)嵌在程序中比較安全。

論壇徽章:
0
9 [報告]
發(fā)表于 2012-04-01 08:58 |只看該作者
iamlimeng 發(fā)表于 2012-04-01 08:50
失敗的原因是:未允許啟動程序時自動釋放綁定的文件。將Automatic at startup選項(xiàng)選定,這樣,程序運(yùn)行時, ...


學(xué)習(xí)了
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP