CPAN::Plugin::Specfile - 概念驗證,實作一個微不足道的 CPAN::Plugin
# once in the cpan shell
o conf plugin_list push CPAN::Plugin::Specfile
# make permanent
o conf commit
# any time in the cpan shell to write a spec file
test Acme::Meta
# disable
# if it is the last in plugin_list:
o conf plugin_list pop
# otherwise, determine the index to splice:
o conf plugin_list
# and then use splice, e.g. to splice position 3:
o conf plugin_list splice 3 1
實作為後測試掛鉤,此外掛程式會在每次成功的測試執行後撰寫一個 specfile。內容也會寫入終端機。
作為副作用,所撰寫的 specfile 的時間戳記會反映所有依賴項目的線性順序。
警告:這段程式碼只是一個小範例,說明如何使用 CPAN shell 的外掛程式系統,而不是一個功能齊全的 spec 檔案撰寫器。不要期待此外掛程式有新功能。
儲存 spec 檔案的目標目錄可以使用 dir
設定,如下所示
o conf plugin_list push CPAN::Plugin::Specfile=dir,/tmp/specfiles-000042
預設目錄為 cpan_home 目錄中的 plugins/CPAN::Plugin::Specfile
目錄。
Andreas Koenig <andk@cpan.org>、Branislav Zahradnik <barney@cpan.org>