[please cc the mod_perl list when responding]

Mag Gam wrote:
> Fred:
>
> Thanks. Looks like I may look into Mason for its simplification. I don't think I have a the patience or enthusiasm to learn the REquestReq feature of Mp2.

It's not that hard, I would say it's no more complex than Mason (but there are varying schools of thought on that subject which I will not go into here). Here is a hello world handler to give you an example of how to get started.

conf/httpd.conf
--------------------------
<Location />
  SetHandler perl-script # tells apache mod_perl handles the request
  PerlResponseHandler My::Hello  # My::Hello::handler handles / requests
</Location>

lib/My/Hello.pm
------------------------
package My::Hello;

use strict;
use warnings;

use Apache2::RequestRec ();  # for $r->content_type
use Apache2::RequestIO  ();  # for $r->print
use Apache2::Const -compile => qw( OK );  # for Apache2::Const::OK

sub handler {
   my $r = shift;  # <== here is where you get $r

   $r->content_type('text/plain');  # set the content type to text/plain
   $r->print("Hello world!");       # print the response to the client

   return Apache2::Const::OK;  # return 200 OK
}

HTH

> On 8/11/07, *Fred Moyer* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
>      > I noticed I have to use Apache::Request and Apache::Cookie.
>      > In, http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html,
>     there is
>      > a
> > $r which is request object. How do I create that? Is there an example
>      > anywhere I can follow?
>
> It sounds like you haven't created a mod_perl handler before, this page
>     should answer your questions.
>
>     http://perl.apache.org/docs/2.0/user/intro/start_fast.html
>
>      > On 8/10/07, Jonathan Vanasco <[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>> wrote:
>      >>
>      >>
>      >> On Aug 10, 2007, at 10:25 PM, Mag Gam wrote:
>      >>
> >> > I have just started learning perl and mod_perl, and I must admit I
>      >> > am enjoying it a lot!
> >> > I am tying to upload a file, so I can do some calculations to the
>      >> > file, my question is what is the "correct" and most
>     "efficient" way
>      >> > to upload the file, and perform the calculations? Should I
>     consider
>      >> > using the CGI module?
>      >>
>      >> libapreq
>      >>         http://httpd.apache.org/apreq/
>      >>
>      >> CGI is a close second
>      >>
>      >
>
>
>



Reply via email to