in reply to (8)Exec format error: when running the script on Linux

Sounds like a problem with a system call or binary.
What happens if you just run the first part of the program? Just the "#!" and the "use" lines.

non-Perl: Andy Ford

  • Comment on Re: (8)Exec format error: when running the script on Linux

Replies are listed 'Best First'.
Re^2: (8)Exec format error: when running the script on Linux
by ikkon (Monk) on Jan 19, 2007 at 18:36 UTC
    the code broke when I put in the following parts:
    print header( "application/pdf" ); use constant mm => 25.4/72; use constant in => 1/72; use constant pt => 1; sub setImage; sub newText; sub newTextRight; sub checkCurrency; sub GrabParams; my $q = new CGI; my %valueHash; GrabParams();
    and this function: <code> sub GrabParams{ my ( $paramName, $paramValue); foreach $paramName ($q->param) { $valueHash{$paramName}; foreach $paramValue ($q->param( $paramName )) { $valueHash{ $paramName } = pack 'U0A*', $paramValue; } } } <code> all though it works on my windows machine.

      So GrabParams is the problem? I.e. if you don't call GrabParams() is doesn't fail?
      If that's the case, then maybe you need to look at the pack call. The most basic thing would be to put in some print statements to make sure the params are what you thing they should be.
      Have you run this from the command line or just via the webserver? Maybe something's wrong in the web server infrastructure.

      non-Perl: Andy Ford

      Try taking out these:

      sub setImage; sub newText; sub newTextRight; sub checkCurrency; sub GrabParams;
      I don't know what they're for. As far as I know, you don't pre-declare subroutines in Perl.

      non-Perl: Andy Ford

        You don't have to, but it can be done. It basically lets the parser know that if it encounters those things in a bareword context to treat them as sub invocations rather than bareword strings. That lets you use them without parens before the actual subroutine declaration later in the source.

        use strict; sub foo; ## This line will not cause an error . . . foo "ABC"; ## . . . but this one does bar "DEF"; sub foo { print @_ } sub bar { print @_ }