Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: creating utility in perl

by dasgar (Priest)
on Jul 04, 2013 at 05:54 UTC ( #1042330=note: print w/replies, xml ) Need Help??

in reply to creating utility in perl

My suggestion would be to install PAR::Packer from CPAN and use the pp utility (from the PAR::Packer module) to create a stand-alone executable.

(NOTE: The PAR::Packer module needs to be compiled, which means that you need a compiler and compiler tools to do this with. If you're on a *nix like OS, you might already have those installed.)

Replies are listed 'Best First'.
Re^2: creating utility in perl
by Anonymous Monk on Jul 04, 2013 at 06:11 UTC

    hey if I use PAR::Packer , then the user will have to install cpan in his system as well . I want to create like we use utilities , no need of installing anything , just execute and give the inputs .

    So what if I have cpans in my program as well , I just need to know two things

    1) Do every user using this standalone , will have to install this PAR::Packer , or just the creator 2) What if in the script some CPan is used , after PAR::Packer ,do every user will have to install that CPAN also

    the thing is I wish to make it user friendly , so i need to abstract all these things from user

      hey if I use PAR::Packer , then the user will ahve to install cpan in his system as well.

      Did you even read the documentation? (Nevermind, we already know the answer to that question.)

      This is exactly what PAR::Packer, and the pp utility are designed to avoid. The point is that using a solution such as PAR::Packer you can distribute a standalone application.


      The pp utility in PAR::Packer will bundle your code, the modules needed by your code and the Perl interpreter into a stand-alone executable. That means the executable contains everything needed to run the script. For example, let's say that you've got two systems that have the same OS, but Perl is only installed on system A. So you create a Perl script on system A and use pp to create an executable. You can now take that executable to system B and it will be able run the executable just fine. System B could have no Perl installed, different version of Perl installed, missing required modules, etc. and none of that matters because it is using the contents of the executable.

      There are some caveats and exceptions to what I described above, but what I described is accurate. Try installing PAR::Packer and read up on the documentation of the pp utility. It will do exactly what you're wanting to do.

      Check this NOTES it will answer your question and satisfy the longing of your heart..

      If you tell me, I'll forget.
      If you show me, I'll remember.
      if you involve me, I'll understand.
      --- Author unknown to me

        so i will give you the entire detail of what , how I have done , and the issue I am having .

        I have a script which uses Text::CSV cpan , I installed that cpan in my PC and its working fine . Now I wanted to make an exe file ,so I installed PAR::Packer and pp and created .exe successfully with this code  pp -o packed.exe

        so now when I run this executable on some other system which does not have this Text::CSV cpan it fails . I want that user without installing this cpan , and if possible even without installing perl be able to execute this exe file

        Is it possible for me to be able to do it

        FYI i also did pp -P -o to make a packaged file , but when I execute it , an error saying "The application has failed to start because perl516.dll was not found " is shown

        wow long post , I have followed every step as you guys described installed PAR::Packer and pp . It is confirmed they are installed properly as cpan in strawberry says so . The a.exe is created in PAR::Packer , but it does not run , if I click on it , it opens momentarily dies and via command prompt too the same thing is happening . I can't understand the reason why ? And with me there is no proxy issue
        so I just have to type these commands before my script to do so , if not then how to do it ??
        % pp -o packed.exe $ packed.exe

        sorry for asking so basic questions , first time user

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1042330]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2018-06-25 20:37 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (128 votes). Check out past polls.