Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Converting perl script to exe

by madtoperl (Pilgrim)
on Jul 26, 2006 at 13:37 UTC ( #563788=perlquestion: print w/replies, xml ) Need Help??
madtoperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I have to convert perl script to exe in Sun-solaris server.I have downloaded perl2exe for perl version 5.6.1 for solaris and installed in the server.

When i tried to convert the perl script to exe as per the README.TXT file,it is giving the following error that,
[dragon:steno]perl2exe ksh: perl2exe: not found [dragon:steno]
But If i put ls command,the perl2exe.exe file is found there.Monks help me to know why this command is not converting the perl script to exe.
Thanks and Regards,

Considered by davorg: mark as off-topic
Unconsidered by planetscape: keep votes trump edit votes ( keep:18 edit:18 reap:5 )

Replies are listed 'Best First'.
Re: Converting perl script to exe
by davorg (Chancellor) on Jul 26, 2006 at 13:44 UTC

    You're trying to run a command on a Unix platform and the shell is complaining that it can't find the file. I'm not sure why you think this is a Perl problem. The problem would be the same no matter what program you were trying to run.

    I suggest you check the contents of your path. I suspect that your sysadmin is security conscious and doesn't include the current directory in the default path for users on that server. This is a very good policy. But it means that in order to run a program from the current directory you need to give the path to the program. Usually just ./program_name will suffice.


    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Converting perl script to exe
by liverpole (Monsignor) on Jul 26, 2006 at 14:45 UTC
    Hi madtoperl,

    As davorg mentioned, perl2exe is probably not in your path, meaning that your path probably doesn't contain the current directory ".".

    You can either try calling it directly:


    Or you can try temporarily putting the current directory "." in your path with one of the following:

    # If you use 'bash' (or similar), add '.' to the path this way export PATH=.:$PATH hash # If you use 'tcsh' (or similar), add '.' to the path this way set path = ( . $path ) rehash

    Notice that you should do the 'hash' (or 'rehash' command in tcsh) to be sure that the change to the path take immediate effect.


      But the current directory is omitted from the default path for very good reasons. It's not a good idea to add it.


      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

        The example I gave was for adding it to the current shell only (as I'm sure you know).

        Although I actually do have it in my default path (that's what I'm used to), I agree that it's not the recommended practice, otherwise I would have suggested something more permanent, like adding it to the user's startup file (ie. .bashrc or .tcshrc).

Re: Converting perl script to exe
by chargrill (Parson) on Jul 26, 2006 at 15:54 UTC

    Hi madtoperl,

    One thing that maybe others have overlooked is that you're trying to call the command via "perl2exe", but further down in your post, you refer to it as "perl2exe.exe".

    While binary (executable) files on solaris generally don't have the .exe extension, if yours truly is A) a solaris executable with B) an .exe extension, you'll need to run it via specifying the full name of the executable:


    If perl2exe.exe is in your current directory, then ./perl2exe.exe should suffice.

    One other thing that would help me understand your problem (in case this doesn't address it) - where did you find the perl2exe.exe program for solaris?

    Update: Ok, looks like I found it with a little googling and forum reading: perl2exe.

    Chances are that after you installed it, it is located in /usr/local/bin/perl2exe, and more than likely doesn't have the .exe extension as you alluded it might.

    Update2: A breif perusal of the docs show:

    Installation - Perl2Exe for Unix on a Unix host 1. Add ~/per2exe and ~/perl2exe/perl5/bin to your path.

    Others have already given suggestions for how to do that. Hope that helps.

    $,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s +plit//=>$* ){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$# +C]=$/;($#C >$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^ +$$C[$%++]}
Re: Converting perl script to exe
by Moriarty (Abbot) on Jul 27, 2006 at 03:08 UTC


    The reason the shell can't find perl2exe is quite simple, it's not called perl2exe, it's called perl2exe.exe. *nix, unlike windoze, considers the '.exe' to be part of the filename.

    I would, of course, question whether this was a Solaris executable, and it appears from other responses that, even if it is a Solaris executable, it's not the best tool for the job.

    Update: There is also the possibility that the current directory isn't in your path.

Re: Converting perl script to exe
by lorn (Monk) on Jul 26, 2006 at 13:46 UTC

    if you want to create *.exe, go to windows and install active perl, if you want to create a binary file of your perl script on solaris, perlcc.

    Update: Forget perlcc, use PAR ;)


      Erm, no. The very experimental perlcc never really worked well, if at all. PAR is a better route.

      Update: Not to mention you were told the same thing just recently (well, a few months ago).

        yes, i forget that :( , in my node, i wanted to do that because my boss needed "close" the source of program perl.

        Update: Sorry, now my reply is on the rigth place thanks to Hue-Bond.

Re: Converting perl script to exe
by arkturuz (Curate) on Jul 26, 2006 at 14:18 UTC
    Assuming that your program is a Solaris executable file (compiled for that platform), have you tried chmod +x perl2exe.exe?
    It will mark your program as being executable. See more here.

    Update: Wrong assumption, wrong answer. Ignore it.

      That would give a "permission denied" error, not the "file not found" error that was reported.


      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

        Indeed. I was mislead by something which I cannot really remember what it was.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://563788]
Approved by prasadbabu
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2018-05-21 10:11 GMT
Find Nodes?
    Voting Booth?