cbouwkamp has asked for the wisdom of the Perl Monks concerning the following question:

Edit: I have been able to get rid of some errors but I still get some. Even if I add mojolicious and all the modules I am using I still get these. Here they are:
I18N\Langinfo.pm: error: Can't locate I18N\Langinfo.pm refby: C:\Perl\lib\Encode\Locale.pm line 51 Can't locate Mojo/EventEmitter.pm in @INC (@INC contains:) at /<C:\Use +rs\Chris\Desktop\Crysys\RTXCountdown\RTX.exe>Mojo/Base.pm line 32. BEGIN failed--compilation aborted at /<C:\Users\Chris\Desktop\Crysys\R +TXCountdown\RTX.exe>Mojo/UserAgent.pm line 2. BEGIN failed--compilation aborted at /<C:\Users\Chris\Desktop\Crysys\R +TXCountdown\RTX.exe>Google/Voice.pm line 6. BEGIN failed--compilation aborted at RTX.pl line 4.
I am trying to create a .exe in perl. The program works fine until I try to create it with perlapp. I am using Komodo IDE 5. I have posted my script and the error below. I have added the modules, LWP::UserAgent, NET, and Google::Voice. Lastly I have tried updating mojolicious and google::voice since thats what it is listing to no avail
#!/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 op +en 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;
Errors
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:\Use +rs\Chris\Desktop\Countdown\RT.exe>Mojo/Base.pm line 32. BEGIN failed--compilation aborted at /<C:\Users\Chris\Desktop\Countdow +n\RT.exe>Mojo/UserAgent.pm line 2. BEGIN failed--compilation aborted at /<C:\Users\Chris\Desktop\RTCountd +own\RT.exe>Google/Voice.pm line 6. BEGIN failed--compilation aborted at RT.pl line 4.

Replies are listed 'Best First'.
Re: Troubles creating a .exe
by Marshall (Canon) on Feb 26, 2012 at 02:49 UTC
    If I understand you correctly, this is actually a very common problem when making .exe's. The program runs, but not after you've made the .exe. Problem is that some things are "autoloaded" when running native and you need to get that stuff into the .exe. Easy way is to add "use Algorithm::Diff;" etc to the source code. This a "hint" that will cause PerlApp to include that into the .exe - then it will be found when the .exe runs. Any module that has an explicit "use" statement gets forced into the .exe.

    If these are errors from PerlApp instead of .exe run time errors, then that means that the modules were not installed correctly using PPM. With ActiveState only use PPM for module installation! Active State PPM (Perl Package Manager) works with pre-compiled .ppd files. If the modules are installed correctly (ie with PPM), PerlApp will find the XS DLL's, etc.

    I've been a PerlApp user for more than a decade and this thing works well. I would use the GUI version which allows you to save all of the settings as a type of "project file". This is easier than working with the command line and 5 bazillion options.

    Anyway more of explanation of where this is going wrong would help. I hope what I said the first 2 paragraphs is helpful. I believe that is likely to solve your problem.

      I do use PPM to install my packages. It actually is recently that I have started getting the errors using perlApp. When I try to add Net Module it says that it cannot locate it. I then go to ppm and it says that it is installed in the library it is pointing to.
        This kind of "oh, it used to work, but it doesn't any more" question is different.

        I would assume that something changed and we don't know what.What does your %path% environment variable say?

        Did you upgrade Perl in the meantime?

        It is possible to "re-initialize" your system. Of course a full back-up is mandatory before you try this!!!...

        see "ppm help" for ppm profile save and ppm profile restore.

        This generates an XML file that can be fed into ppm to re-install your modules. Make a profile, Uninstall Perl,reboot, reinstall Perl, use ppm to run this saved profile. DANGER: Depending upon the Perl upgrade history of your machine, this may cause some trouble!

        However, at this point, I'm thinking that something has gone wrong in the path rather than some fundamental flaw in the installation. I mean you have runnable code outside of the .exe so something about your installation is right!

        What does this mean: "When I try to add Net Module it says that it cannot locate it"? Add by what means?
Re: Troubles creating a .exe
by CountZero (Bishop) on Feb 26, 2012 at 20:29 UTC
    Warning: I am not a user of PerlApp.

    For some strange reason your @INC array seems to be empty, hence perl will not be able to find any module. It simply does not know where to look for it.

    To see if that is actually so, try to compile and run this: print "$_\n" for @INC;

    Run it from the command line; from Komodo and from your .exe. You are likely to have three different results.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics

      Warning: I am not a user of PerlApp.

      For some strange reason your @INC array seems to be empty, hence perl will not be able to find any module.

      No, perl can't find the files because they're not in the .exe, because perlapp didn't package them.

      That perlapp makes @INC empty is irrelevant, since perlapp didn't pack the missing files because it didn't know it needed to pack them.

      Helping perlapp by naming all the modules that need to be packed, I have adressed in Re: Troubles creating a .exe

        One should have thought PerlApp could try to find itself the modules it uses.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        My blog: Imperial Deltronics
      I get this output from the komodo IDE C:\Program Files (x86)\ActiveState Komodo IDE 5\lib\support\dbgp\perllib C:/Perl/site/lib C:/Perl/lib this from the command line C:/Perl/site/lib C:/Perl/lib and the perlapp lets me create a .exe but there is no output from it
Re: Troubles creating a .exe
by Marshall (Canon) on Feb 26, 2012 at 08:23 UTC
    Out of curiosity, where did you get a .ppd file for Google::Voice from? I was trying to download enough stuff to compile this myself, but I couldn't find that module. I found the test matrix, but I couldn't find a .ppd file. That may because I am on Windows and you are on Linux?

      That may because I am on Windows and you are on Linux?

      The OP is on windows, and Google::Voice is a pure-perl module

Re: Troubles creating a .exe
by Anonymous Monk on Feb 26, 2012 at 07:57 UTC
    Net.pm:
        error: Can't locate Net.pm
        refby: perlapp --add Net::
    

    Please show how you invoke perlapp, and then do not add -add Net:: , there is no module named Net::

    You should however add

    --add Algorithm::Diff::XS  
    --add Date::Calc::XS  
    --add I18N::Langinfo  
    --add JSON::PP58  

    You can generate a list of modules to add by seeing which modules are actually loaded, like so

    #!/usr/bin/perl -- CHECK { print "\n\nsystem qw[ perlapp\n"; for my $k ( sort keys %INC ){ if( $k =~ s/\.pm$// ){ $k =~ s{/}{::}g; print " --add $k\n"; } } print "\n];\n\n "; exit 0; } use Net::Netrc ; use Encode::Locale; __END__ system qw[ perlapp --add Carp --add Config --add DynaLoader --add Encode --add Encode::Alias --add Encode::Byte --add Encode::Config --add Encode::Encoding --add Encode::Locale --add Exporter --add Exporter::Heavy --add Fcntl --add File::Basename --add File::Spec --add File::Spec::Unix --add File::Spec::Win32 --add FileHandle --add IO --add IO::File --add IO::Handle --add IO::Seekable --add Net::Netrc --add SelectSaver --add Symbol --add Win32::API --add Win32::API::Struct --add Win32::API::Type --add Win32::Console --add XSLoader --add base --add bytes --add constant --add strict --add vars --add warnings --add warnings::register ];