我剛剛構建了Rakudo和Parrot,以便我可以使用它並開始學習Perl 6.我下載了Perl 6書籍,並愉快地輸入了第一個演示程序(網球比賽示例)。當我嘗試用Rakudo運行腳本時,爲什麼會得到'除以零'錯誤?
當我嘗試運行該程序,我得到一個錯誤:
Divide by zero
current instr.: '' pc -1 ((unknown file):-1)
我有我的build目錄perl6
二進制文件。我添加了一個腳本,目錄rakudo build目錄下:
rakudo
|- perl6
\- scripts
|- perlbook_02.01
\- scores
如果我試圖從我的腳本目錄中運行,即使一個簡單的Hello World腳本,我得到了同樣的錯誤:
#!/home/daotoad/rakudo/perl6
use v6;
say "Hello nurse!";
但是,如果我跑它來自rakudo
目錄。
聽起來好像有一些我需要設置的環境變量,但我對失去的是什麼以及給它們什麼值。
有什麼想法?
更新:
我寧願不要在此時安裝rakudo,我寧願只從構建目錄運行的東西。這將允許我保留對系統的更改,因爲我嘗試了不同的Perl6構建(Rakudo *即將推出)。
README文件鼓勵我認爲這是可能的:
$ cd rakudo $ perl Configure.pl --gen-parrot $ make
This will create a "perl6" or "perl6.exe" executable in the current (rakudo) directory. Programs can then be run from the build directory using a command like:
$ ./perl6 hello.pl
在重讀,我發現這樣的事實,有必要構建目錄外運行腳本之前安裝rakudo參考:
Once built, Rakudo's
make install
target will install Rakudo and its libraries into the Parrot installation that was used to create it. Until this step is performed, the "perl6" executable created bymake
above can only be reliably run from the root of Rakudo's build directory. Aftermake install
is performed, the installed executable can be run from any directory (as long as the Parrot installation that was used to create it remains intact).
所以看起來我需要安裝rakudo用Perl 6
玩的,其中rakudo安裝接下來的問題? README對用於構建的Parrot安裝說。
我在我的版本中使用了--gen-parrot
選項,它看起來像安裝到rakudo/parrot-install
。所以rakudo會被安裝到我的rakudo\parrot-install
?
讀取Makefile,支持這個結論。我跑了make install
,它確實安裝到parrot_install
。
構建/安裝過程的這一部分對於Perl6的新手來說還不清楚。我會看看是否可以用文檔補丁來澄清事情。
關閉我的頭頂:
構建之外運行腳本之前強調運行
make install
。這個要求目前被埋在段落的中間,並且可以通過瀏覽文檔(我)輕易地被忽略。明確指出,
--gen-parrot
會將perl6安裝到parrot_install
目錄中。
感謝您的回答。我更新了我的問題以提供更大的迴應。 – daotoad 2010-06-30 00:57:14