http://www.perlmonks.org?node_id=563788

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

This node falls below the community's threshold of quality. You may see it by logging in.

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.

    --
    <http://dave.org.uk>

    "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:

    ./perl2exe sample.pl

    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.


    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

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

      --
      <http://dave.org.uk>

      "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).


        s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
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:

    /path/to/perl2exe.exe sample.pl

    If perl2exe.exe is in your current directory, then ./perl2exe.exe sample.pl 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.



    --chargrill
    $,=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

    Hi

    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 ;)

    Lorn
    -http://lornlab.org
    -slackwarezine.com.br

      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.

A reply falls below the community's threshold of quality. You may see it by logging in.