Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Unfortunately it doesn't work for me.
My mod_perl/startup.pl looks like this:
use strict; use Apache::DBI; use Apache2::Request; use File::Slurp; use Net::SMTP; #use CGI; #CGI->compile(':all'); Apache::DBI->connect_on_init('DBI:mysql:dbname::localhost', "user", "* +*****", { PrintError => 1, # warn() on errors RaiseError => 0, # don't die on error AutoCommit => 1, # commit executes mysql_enable_utf8 => 1, # immediately } ) or die "Cannot connect to database: $DBI::errstr";
And then there's a myscript.pl in the mode_perl dir that looks like this:
#!/usr/bin/perl use strict; use warnings; my $r = shift; my $cgi = Apache2::Request->new($r); my $QUERY; if ($cgi->param('q') =~ /^([a-zA-Z0-9\ \.\,\-_\:\;]+)$/) { $QUERY = $1; } my $ruri = $ENV{'REQUEST_URI'}; $ruri =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; ... ... if ($sth->rows == 0) { #$r->err_headers_out->set(Location => "$ruri/"); $r->status(404); #$r->status(Apache2::Const::NOT_FOUND); $r->content_type('text/html'); $r->print(<<"END"); <html> <head><title>handler</title></head> <body> Hello from ME.<br /> </body> </html> END ModPerl::Util::exit(0); } ... ...

In reply to Different context by Jaap
in thread mod_perl give 404 not_found with content by Jaap

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found