Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Keep It Simple, Stupid
 
PerlMonks  

Why behaviour changes after converting to exe

by madtoperl (Hermit)
on Jul 31, 2006 at 02:27 UTC ( [id://564689]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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

Hi Monks,

Nice day!!I am running this code in Activeperl 5.8,I have the following piece of code,
#!/bin/perl-w use DateTime; print"Hello world\n";
When i run the above code in .pl file,it is working fine.But when i converted it to exe file by using par module and running the exe file,it is showing the message that en_US.pm moudle not found as shown below,
C:\Perl\bin>perdate.exe Can't locate DateTime/Locale/en_US.pm in @INC (@INC contains: CODE(0xd +facec) C:\ DOCUME~1\regan\LOCALS~1\Temp\par-regan\cache-1154325548/inc/lib C:\DOC +UME~1\rega n\LOCALS~1\Temp\par-regan\cache-1154325548/inc CODE(0xceaa3c) .) at (e +val 14) li ne 3. Compilation failed in require at script/perdate.pl line 2. BEGIN failed--compilation aborted at script/perdate.pl line 2.
Could anyone explain me why its behaviour changes when converted to exe file.Also when i tried to install the en_US module by using ppm,i found the following error
C:\Perl\bin>ppm install en_US Error: Failed to download URL http://www.soulcage.net/ppds.58/en_US.pp +d: 404 No Found
I googled it to found in other site,Quite not found anywhere.Pls help me to solve this issue??

Replies are listed 'Best First'.
Re: Why behaviour changes after converting to exe
by reneeb (Chaplain) on Jul 31, 2006 at 03:28 UTC
    the en_US.pm file is part of the DateTime::Locale distribution. Try to add the module to the PAR archive manually:

    pp -M DateTime::Locale -o script.exe script.pl
      pp -M DateTime::Locale -o script.exe script.pl

      That doesn't work for me ... close, but not quite. I found I had to specifically load DateTime::Locale::en_US:
      pp -M DateTime::Locale::en_US -o script.exe script.pl
      Cheers,
      Rob
        Hi syphilis,

        That worked fine for me.Thanks a lot.But I am assigning some values to that by creating an object,see the code below,
        #!/bin/perl-w use DateTime; my $runtime = DateTime->new( year => 2006, month => 07, day => 31, hour => 9, minute => 54, #time_zone => "America/Los_Angeles", time_zone => "Indian/Christmas", ); print"Runtime=> $runtime\n";
        When I run the above code by using .pl file it is working.But when i convert it to exe by using pp -M DateTime::Locale::en_US -o perdate.exe perdate.pl it is not working and showing the meesage,
        C:\Perl\bin>perdate.exe The timezone 'Indian/Christmas' could not be loaded, or is an invalid +name.
        But that timezone is already found and working fine for .pl file.Could you suggest why?? and help me to solve this.
      Hi reneeb,

      Thanks for your try.But again the converted exe is giving the same error.Any other suggestion please.

      Thanks.
Re: Why behaviour changes after converting to exe
by dirving (Friar) on Jul 31, 2006 at 14:08 UTC
    You may be able to use the -x switch of pp to have it catch these dependencies. Be careful though: because this switch actually runs the program, if the program never terminates or does some destructive operation this might have undesired effects.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://564689]
Approved by Corion
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.