2012-02-25 83 views
1

我试图在perl中创建一个.exe文件。它工作正常,直到我尝试将其编译为exe文件。我正在使用Komodo IDE 5.我已经发布了我的脚本和下面的错误。我已经添加了模块,LWP :: UserAgent,NET和Google :: Voice,它仍然不起作用。我用perlapp创建的.exe将Perl脚本编译为.exe错误

#!/usr/bin/perl -w 
use strict; 
use warnings; 
use Google::Voice; 
use Date::Calc qw(Delta_Days); 
use Net::Twitter; 

#Set Days 
    my @today = (localtime)[5,4,3]; 
    $today[0] += 1900; 
    $today[1]++; 
    my @RT = (2012, 7, 7); 
    my $days = Delta_Days(@today, @RT); 

#Get Quotes and Phone Numbers 
    open FILE, "c:/Countdown/countdownNumbers.txt" or die "Couldn't open file: $!"; 
    my $numbers = join("", <FILE>); 
    close FILE; 
    open FILETWO, "c:/Countdown/Quotes.txt" or die "Couldn't open file: $!"; 
    my $quotes = join("", <FILETWO>); 
    close FILETWO; 

#Create Arrays and Lengths 
    my @numbersArray = split(/[\n\r\l]+/, $numbers); 
    my @quotesArray = split(/[\n\r\l]+/, $quotes); 
    my $length = @numbersArray; 
    my $QuotesLength = @quotesArray; 

#Send Text Message 
    for(my $i = 0; $i < $length; $i++){ 
     my $g = Google::Voice->new->login('secret', 'secret'); 
     $g->send_sms($numbersArray[$i] => "  Countdown\nDays Left: " . $days . "\n Quote:\n" . $quotesArray[0]); 
    } 


#Send Twitter Message 
    my $nt = Net::Twitter->new(
     traits => [qw/OAuth API::REST/], 
     consumer_key  => 'secret', 
     consumer_secret  => 'secret', 
     access_token  => 'secret', 
     access_token_secret => 'secret' 
    ); 
    my $result = $nt->update($days .' Days left!'); 
    $result = $nt->update('Quote: ' . $quotesArray[0]); 

#Rewrite the file and close it 
    open FILETWO, ">c:/Countdown/Quotes.txt"; 
    for(my $i = 1; $i < $QuotesLength; $i++){ 
     print FILETWO $quotesArray[$i] . "\n"; 
    } 
    close FILETWO; 

错误

Algorithm\Diff\XS.pm: 
    error: Can't locate Algorithm\Diff\XS.pm 
    refby: C:\Perl\site\lib\Array\Diff.pm line 7 
Date\Calc\XS.pm: 
    error: Can't locate Date\Calc\XS.pm 
    refby: C:\Perl\lib\Date\Calc.pm line 26 
I18N\Langinfo.pm: 
    error: Can't locate I18N\Langinfo.pm 
    refby: C:\Perl\lib\Encode\Locale.pm line 51 
JSON\PP58.pm: 
    error: Can't locate JSON\PP58.pm 
    refby: C:\Perl\lib\JSON\PP.pm 
Net.pm: 
    error: Can't locate Net.pm 
    refby: perlapp --add Net:: 

Can't locate Mojo/EventEmitter.pm in @INC (@INC contains:) at /<C:\Users\Chris\Desktop\Countdown\RT.exe>Mojo/Base.pm line 32. 
BEGIN failed--compilation aborted at /<C:\Users\Chris\Desktop\Countdown\RT.exe>Mojo/UserAgent.pm line 2. 
BEGIN failed--compilation aborted at /<C:\Users\Chris\Desktop\RTCountdown\RT.exe>Google/Voice.pm line 6. 
BEGIN failed--compilation aborted at RT.pl line 4. 
+1

尼斯一票下来,没有理由 – shinjuo 2012-02-25 22:45:55

回答

3

编译perl脚本到exe文件不是那么直截了当,我害怕。 )详情请查看this discussion at Perlmonks

从你引述似乎什么,你可能会开始修复与安装额外的模块:算法:: DIFF :: XS,日期::计算器:: XS等

+0

我已经添加模块,它希望它给出了同样的错误不能找到魔/ EventEmitter @INC中的.pm(@INC包含:)在/Mojo/Base.pm第32行。 BEGIN失败 - 编译在/ 中终止。 Mojo/UserAgent.pm第2行。 BEGIN失败 - 编译在/Google/Voice.pm第6行中止。 BEGIN失败 - 在RTX.pl第4行编译异常中止。 – shinjuo 2012-02-27 05:12:45

+0

shinjuou,所以'--add Mojo :: EventEmitter' – obmib 2012-02-27 06:39:24

+0

我也这么做 – shinjuo 2012-02-27 14:48:43

2

如果你使用最新版本perlapp,将此错误发送给ActiveState支持。

暂时你可以使用PAR :: Packer代替perlapp。用cpan shell安装PAR :: Packer(ppm可能不起作用)。然后运行

pp -c t1.pl 

它会创建a.out。如果它不起作用,请从svn:http://svn.openfoundry.org/par/Module-ScanDeps/trunk/安装Module :: ScanDeps - 我为您的程序解决了一些可能的问题。

我从来没有使用过perlapp,但它可能有命令行开关来提供要包含的模块列表。

+0

我从来没有使用PA R :: Packer,它要求我设置GCC环境,我不知道那是什么,也无法输入它。还有什么我需要做的吗? – shinjuo 2012-02-27 05:11:09

+0

在新版本中,它会自动安装在旧版本中 - AFAIR可以通过'ppm install gcc'安装。 – 2012-02-27 13:09:43