[問題] 模組的寫法

看板Perl作者 (bwtalk)時間11年前 (2013/07/24 01:37), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
code越寫越肥.. 想開始學模組寫法 參考了下面網頁的寫法 http://pydoing.blogspot.tw/2013/01/Perl-Module.html 不過每次使用函式都蠻麻煩 要寫一長串.. 例如上面教學的例子 Demo::print_newline(); Demo::print_something(Demo::return_something("There is no spoon.")); 有沒有辦法只要call函式就好 例如上面例子只要呼叫print_newline()即可 不用每次都多打"Demo::" 煩請解惑~ 感謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.20.82

07/24 02:27, , 1F
perldoc Exporter
07/24 02:27, 1F

07/25 00:28, , 2F
同上,或找個常用或短小的非OO module看src, 像是URI::Escape
07/25 00:28, 2F

07/25 00:28, , 3F
perlfaq7 也是個好開始
07/25 00:28, 3F
文章代碼(AID): #1HxhzPs0 (Perl)
文章代碼(AID): #1HxhzPs0 (Perl)