Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

PAR: pp No Perl script found in input

by mkmal (Novice)
on Feb 27, 2013 at 01:39 UTC ( [id://1020792]=perlquestion: print w/replies, xml ) Need Help??

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

Greetings Perl Monks,

I am using ActivePerl on Windows 7. I installed PAR and attempted to convert a simple Perl script to a .exe using pp.
I received the following error.

pp test.pl -o test.exe
No Perl script found in input

I confirmed that test.pl does exist in this directory and runs just fine using straight perl.
I moved the perl script to where pp.bat is located C:\Perl\site\bin.
This time it worked perfectly and created a test.exe file which runs as expected.

C:\Perl\site\bin>pp test.pl -o test.exe

Set up gcc environment - 3.4.5 (mingw-vista special r3)
Set up gcc environment - 3.4.5 (mingw-vista special r3)
...

C:\Perl\site\bin>dir test.exe
Directory of C:\Perl\site\bin
02/26/2013 07:19 PM 2,556,852 test.exe

I tried adding the directory my Perl scripts are located in to my PATH variable but still can not create a .exe unless I am in C:\Perl\site\bin. Is there something else I need to set?

Replies are listed 'Best First'.
Re: PAR: pp No Perl script found in input
by 7stud (Deacon) on Feb 27, 2013 at 03:40 UTC
    From the docs:
        % pp hello.pl               # Pack 'hello.pl' into executable 'a.out'
        % pp -o hello hello.pl      # Pack 'hello.pl' into executable 'hello'
                                    # (or 'hello.exe' on Win32)
    
        % pp -o foo foo.pl bar.pl   # Pack 'foo.pl' and 'bar.pl' into 'foo'
        % ./foo                     # Run 'foo.pl' inside 'foo'
        % mv foo bar; ./bar         # Run 'bar.pl' inside 'foo'
        % mv bar baz; ./baz         # Error: Can't open perl script "baz"
    
        % pp -p file                # Creates a PAR file, 'a.par'
        % pp -o hello a.par         # Pack 'a.par' to executable 'hello'
        % pp -S -o hello file       # Combine the two steps above
    
        % pp -p -o out.par file     # Creates 'out.par' from 'file'
        % pp -B -p -o out.par file  # same as above, but bundles core modules
                                    # and removes any local paths from @INC
        % pp -P -o out.pl file      # Creates 'out.pl' from 'file'
        % pp -B -p -o out.pl file   # same as above, but bundles core modules
                                    # and removes any local paths from @INC
                                    # (-B is assumed when making executables)
    
        % pp -e "print 123"         # Pack a one-liner into 'a.out'
        % pp -p -e "print 123"      # Creates a PAR file 'a.par'
        % pp -P -e "print 123"      # Creates a perl script 'a.pl'
    
        % pp -c hello               # Check dependencies from "perl -c hello"
        % pp -x hello               # Check dependencies from "perl hello"
        % pp -n -x hello            # same as above, but skips static scanning
    
        % pp -I /foo hello          # Extra include paths
        % pp -M Foo::Bar hello      # Extra modules in the include path
        % pp -M abbrev.pl hello     # Extra libraries in the include path
        % pp -X Foo::Bar hello      # Exclude modules
        % pp -a data.txt hello      # Additional data files
    
        % pp -r hello               # Pack 'hello' into 'a.out', runs 'a.out'
        % pp -r hello a b c         # Pack 'hello' into 'a.out', runs 'a.out'
                                    # with arguments 'a b c'
    
        % pp hello --log=c          # Pack 'hello' into 'a.out', logs
                                    # messages into 'c'
    
        # Pack 'hello' into a console-less 'out.exe' with icon (Win32 only)
        % pp --gui --icon hello.ico -o out.exe hello
    
        % pp @file hello.pl         # Pack 'hello.pl' but read _additional_
                                    # options from file 'file'
    

    In the examples, I don't see any file names that are to the left of an option. Based on that observation, I would be disinclined to put a file name to the left of an option.

    Typically, unix commands are ordered like this:

    command -option option_value FILENAME_THAT_IS_TARGET_OF_COMMAND
    

    For the pp command, the default output file is named a.out, however you can use the -o option to specify another name for the output file. So using the unix command template:

    command -option option_value FILENAME_THAT_IS_TARGET_OF_COMMAND
      pp      -o     test.exe          test.pl
    

    Also, based on the second example in the docs, I think the option_value should be just test. See if that works.

      I tried the above but as I expected I got the same result.

      pp -o test.exe test.pl
      No Perl script found in input

      The reason I suspected this would be the case is because as I stated in my original post the command works just fine the way I originally entered it if I move test.pl to the directory where the pp command lives, C:\Perl\site\bin.
      If I run pp from that dir I do get a working test.exe.
      I would expect a syntax error to fail no matter where you run the command. This look like some sort of a PATH issue but I'm not sure what.

      Thanks
Re: PAR: pp No Perl script found in input
by dasgar (Priest) on Feb 27, 2013 at 05:31 UTC
    I am using ActivePerl on Windows 7. I installed PAR and attempted to convert a simple Perl script to a .exe using pp.

    Just wanted to point a few things so that others don't get confused. First, unless you're using an older version of PAR, you will need to install PAR::Packer in order to get the the pp utility. (From PAR::Packer, "Since version 0.97 of PAR, this module and its related tools such as pp have been stripped from the PAR distribution and are now distributed as the PAR-Packer distribution so that PAR users need not necessarily have a C compiler.")

    Secondly, ActivePerl can't install PAR::Packer directly from CPAN without some additional steps. For 32-bit ActivePerl, you'll need to install MinGW and dmake from ActiveState's repository. For users of 64-bit ActivePerl, there's more challenges with the compiler situation, but I'm not familiar with all the details.

    As for the problem that you're hitting, I agree with 7stud that it definitely looks like you're not using the correct syntax.

Re: PAR: pp No Perl script found in input (upgrade)
by Anonymous Monk on Feb 27, 2013 at 09:36 UTC

    How did you install PAR::Packer?

    Whatever version of PAR PAR::Packer you're using you should upgrade -- it works for me

    Also, you should use the -x option

      Greetings,
      I am using the same version you are, I just downloaded it last week.

      pp --version
      PAR Packager, version 1.014 (PAR version 1.007)

      Since pp actually works if I use it in \Perl\site\bin I doubt it an installation issue unless some PATH did not get updated somehow.

      thanks

        Since pp actually works if I use it in \Perl\site\bin I doubt it an installation issue unless some PATH did not get updated somehow.

        You can doubt it, but I am telling you, your installation is messed up

Re: PAR: pp No Perl script found in input
by Anonymous Monk on Feb 27, 2013 at 09:38 UTC

    Sounds like your install of pp is broken

    $ splain ...splain.bat: Reading from STDIN No Perl script found in input No Perl script found in input (#1) (F) You called perl -x, but no line was found in the file beginnin +g with #! and containing the word "perl".

    Try reinstalling

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1020792]
Approved by mbethke
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-16 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found