in reply to CGI::Application and CGI pragmas?

did you try just putting in both those statements?

use CGI qw/-no_undef_params/; use base CGI::Application;

If you want to import all the HTML shortcuts, just add them to the use CGI statement.

use CGI qw/-no_undef_params :standard/;

Since you mention that this is in a mod_perl environment, you should note that the -no_undef_params option may cause all your programs running under mod_perl that use CGI to have that option turned on regradless of how they load CGI.pm. CGI.pm handles these things in Global variables.

Replies are listed 'Best First'.
Re^2: CGI::Application and CGI pragmas?
by Anonymous Monk on May 28, 2005 at 00:23 UTC
    Yeah, I tried that but it seems to step on some mod_perl stuff?

    I get an error message like;
    Can't locate object method "server" via package "request" (perhaps you forgot to load "request"?)
    on some code that looks something like;

    my $r = $self->param('request'); $r->server->loglevel(VERBOSE);
    This code works before importing :standard
    If I just do the pragma nothing seems to happen, i.e. its ignored

      OK, that helps a bit. Are you sure you are getting a proper request object when you call $self->param('request')? It would help if you showed us the code that populates that parameter.

      What I would try instead is call Apache->request->server->loglevel(VERBOSE) and see what that does. If that works, then your problem is with the 'request' parameter you set in CGI::Application. Try dumping that variable using Data::Dumper and you will see exactly what you have there.

        Thanks for helping.
        I finally figured it out. The problem is with the

        $self->param('log' => Apache->request->server->log);

        stuff I was doing. If I

        use CGI qw/:standard/

        I pull in param() as well as things like h1(). All I needed to do was

        qw/:html/