Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: (8)Exec format error: when running the script on Linux

by ikkon (Monk)
on Jan 19, 2007 at 18:36 UTC ( #595525=note: print w/ replies, xml ) Need Help??


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

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.


Comment on Re^2: (8)Exec format error: when running the script on Linux
Download Code
Re^3: (8)Exec format error: when running the script on Linux
by andyford (Curate) on Jan 19, 2007 at 18:53 UTC

    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 @_ }
Re^3: (8)Exec format error: when running the script on Linux
by andyford (Curate) on Jan 19, 2007 at 20:16 UTC

    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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://595525]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2014-10-02 08:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (52 votes), past polls