Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

Re: Problem getting started

Raymond Wan

2008-07-13

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi John,


John M. Dlugosz wrote:
> OK, when I defined $r as you did, it worked. For documentation, I was
> looking at here:
> <http://search.cpan.org/~joesuf/libapreq2-2.08/glue/perl/lib/Apache2/Request.pm>
>
>
> I see you are just printing to standard output, like a CGI script. In
> the book, it used
>
>   $r->send_http_header('text/plain');
>   $r->print("mod_perl rules!\n");
>
> but there are no such methods on $r here in 2.0.
>
> What, prey tell, is the equivalent object?
> Is there =any= way to get started, like a simple (but working!)
> program I could look at?


When I was starting with modperl2, I had similar problems to you. I'm
more of a book-person, and many of the books (such as the O'Reilly ones)
have not been re-released for modperl2. While there is a lot of
information on the web, it isn't as easy sifting through it all.

As for your question, the $r object is (I believe :-) ) the RequestRec
object:

http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html

and instead of send_http_header, you would use content_type. As
mentioned here which describes porting mod_perl 1.0 to mod_perl 2.0:

http://perl.apache.org/docs/2.0/user/porting/compat.html#C__r_E_gt_send_http_header_

You may need to use these two documents (at least) in conjunction with
the book you are reading to make any sense of it. Hope this helps!

Ray



©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.