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

Re: Debugging when using Apache-request;

by spudzeppelin (Pilgrim)
on Jul 31, 2001 at 01:49 UTC ( [id://100990]=note: print w/replies, xml ) Need Help??


in reply to Debugging when using Apache-request;

I can think of several reasons why you could be experiencing a segmentation fault:

  • You have use Apache in your script. That's designed for mod_perl modules; this looks more like a CGI. If you're trying to accelerate CGI with mod_perl, you need to use Apache::Registry instead. Also, if you are trying to implement a CGI, you need to use CGI and/or peek at the values in %ENV to get your input, not by accessing an Apache request object.
  • Also, if it is intended to be a content-handling mod_perl module, it should have an explicit package declaration, and be named somewhere in the Apache config with a PerlHandler directive; if you don't specify otherwise, that PerlHandler directive will be looking for a subroutine in your package called handler to process the request.
  • You have a use vars declaration in the script. Since you are invoking mod_perl, use vars is an open invitation to disaster -- those package globals you just declared are global to that Apache child process for the entirety of that child's lifetime.

Spud Zeppelin * spud@spudzeppelin.com

Replies are listed 'Best First'.
Re: Re: Debugging when using Apache-request;
by IOrdy (Friar) on Jul 31, 2001 at 07:58 UTC
    I read through your points and one thing I dont understand is why I cant use the apache request object ($r->args);

    When I read through the documentation thats what it seemed to be there for.

      I didn't want to say explicitly that you can't, because it depends on what you're trying to do. What I was saying is that from your script, I can't tell which of the following you're trying to implement:

      • A mod_perl content-handler module.
      • A CGI, accelerated with Apache::Registry.
      • Just a plain, old, run-of-the-mill CGI.

      What I was saying, if you reread my post, is that what you can and cannot access depends on which of those three you are implementing. So, which of those three are you implementing?

      Spud Zeppelin * spud@spudzeppelin.com

        ahh, yep I was trying to write an accelerated cgi with Apache::Registry... Since then I spoke to the code guru where I used to work and he told me I should use Apache::Request.


        so I swapped it to:
        my $r = Apache->request;
        my $apr = Apache::Request->new($r);
        
        $apr->param('node'); etc. which he said was better.
        

        thanks for the help though... what you said did make sense and I did take it in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-24 18:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found