You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by jo...@zumu.com on 2012/08/21 21:27:27 UTC

Mod_Perl2 getting started

Hi,
I’m finding the online documentation regarding mod_perl2 confusing
with regards to all the various modules dealing with request structures etc:
APR::Request, Apache2::Request, Apache2::RequestRec, Apache2::Upload,
etc.
Does anyone know of a tutorial or example code that sorts these out?
Ideally a simple one module working code response handler that illustrates access to the 
parsed request, handles args as querystrings and Post data, uploads a file or
two, and returns an html page to the requestor. Anyone have something like that?
Thanks very much in advance,
Joe N

Re: Mod_Perl2 getting started

Posted by jo...@zumu.com.
-----Original Message----- 
From: Fred Moyer
Try this link:
http://perl.apache.org/docs/2.0/user/intro/start_fast.html
--------------------------
Yes, thanks - I've read that.



-----Original Message----- 
From: Fred Moyer
For handling POST data you will likely want to install libapreq2,
which is basically the equivalent of CGI:

http://search.cpan.org/dist/libapreq2/

use Apache2::Request;

    $req = Apache2::Request->new($r);
    @foo = $req->param("foo");
    $bar = $req->args("bar");
-----------------------------------------

Thanks for the specifics- so something like this (below) should not
just die without an error message if I'm on track? (It just dies without
response
or error message - if I remove Apache2::Request->new($r) call it reponds
with the message to the browser..

So I 'm thinking libareq2 is not installed correctly yet?
My server provider is installing the apahce + perl etc. so
I'm partly at their mercy to get it correct. I just had no verified
test cases that I could say to them: This *should* work if the installation
is correct...

Thanks agains,
Joe N


##############
package respHandler;
use strict;

use Apache2::Const qw(:common);
use Apache2::Request ();
1;

sub handler {
    my $r = shift;

    my $req = Apache2::Request->new($r);

    $r->content_type('text/plain');
    print "mod_perl 2.0 OK!\n";

    return OK;
}
#############



Re: Mod_Perl2 getting started

Posted by Fred Moyer <fr...@redhotpenguin.com>.
Try this link:

http://perl.apache.org/docs/2.0/user/intro/start_fast.html

For handling POST data you will likely want to install libapreq2,
which is basically the equivalent of CGI:

http://search.cpan.org/dist/libapreq2/

use Apache2::Request;

    $req = Apache2::Request->new($r);
    @foo = $req->param("foo");
    $bar = $req->args("bar");

On Tue, Aug 21, 2012 at 12:27 PM,  <jo...@zumu.com> wrote:
> Hi,
>
> I’m finding the online documentation regarding mod_perl2 confusing
> with regards to all the various modules dealing with request structures etc:
> APR::Request, Apache2::Request, Apache2::RequestRec, Apache2::Upload,
> etc.
>
> Does anyone know of a tutorial or example code that sorts these out?
>
> Ideally a simple one module working code response handler that illustrates
> access to the
> parsed request,
> handles args as querystrings and Post data, uploads a file or
> two, and returns an html
> page to the requestor. Anyone have something like that?
>
> Thanks very much in advance,
> Joe N

Re: Mod_Perl2 getting started

Posted by Jordan Michaels <jo...@viviotech.net>.
I'd recommend the book:
http://www.amazon.com/Writing-Apache-Modules-Perl-C/dp/156592567X

It's a bit old but many of the topics in it are still relevant and 
useful. Plus, with it being so old, you can get used copies of it very 
affordably.

Hope this helps!

Warm Regards,
Jordan Michaels

On 08/21/2012 12:27 PM, joe@zumu.com wrote:
> Hi,
> I’m finding the online documentation regarding mod_perl2 confusing
> with regards to all the various modules dealing with request structures etc:
> APR::Request, Apache2::Request, Apache2::RequestRec, Apache2::Upload,
> etc.
> Does anyone know of a tutorial or example code that sorts these out?
> Ideally a simple one module working code response handler that
> illustrates access to the
> parsed request,
> handles args as querystrings and Post data, uploads a file or
> two, and returns an html
> page to the requestor. Anyone have something like that?
> Thanks very much in advance,
> Joe N

Re: Mod_Perl2 getting started

Posted by Randolf Richardson <ra...@modperl.pl>.
> Thank you - that's one of the better guides I've seen.
> Funny I didn´t catch it through Google.

	Thanks for the feedback.  It's pretty new so I think it will be some 
time before Google figures out where to place it in the search 
results.

	If you know of anyone else who would find it interesting, you're 
more than welcome to share a link to it with them.  My main concern 
is that I want to see more people using ModPerl 2.

> Joe N
> 
> -----Original Message----- 
> From: Randolf Richardson
> Sent: Tuesday, August 21, 2012 5:13 PM
> To: modperl@perl.apache.org
> Subject: Re: Mod_Perl2 getting started
> 
> > Hi,
> > I´m finding the online documentation regarding mod_perl2 confusing
> > with regards to all the various modules dealing with request structures 
> > etc:
> > APR::Request, Apache2::Request, Apache2::RequestRec, Apache2::Upload,
> > etc.
> > Does anyone know of a tutorial or example code that sorts these out?
> > Ideally a simple one module working code response handler that illustrates 
> > access to the
> > parsed request, handles args as querystrings and Post data, uploads a file 
> > or
> > two, and returns an html page to the requestor. Anyone have something like 
> > that?
> > Thanks very much in advance,
> > Joe N
> 
> Hi Joe.  I wrote one guide that has helped a few people get started:
> 
> http://www.modperl.pl/how-to/
> 
> 


Randolf Richardson - randolf@inter-corporate.com
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
http://www.inter-corporate.com/



AW: Mod_Perl2 getting started

Posted by Al...@external.t-systems.com.
http://perl.apache.org/docs/1.0/guide/porting.html

--
Deutsche Telekom AG
Seamless ICT Security Infrastructure & Management
im Auftrag T-Systems International GmbH
Dipl. Inf Alexander Elgert
Langwadener Strasse 17
64625 Bensheim
+49 176 22 717 661 (Mobil)
+49 671 83419-12 (Tel)
+49 671 83419-30 (Fax)
E-Mail: alexander.elgert@gmx.de

________________________________________
Von: Keywan Ghadami [k.ghadami@ibson.com]
Gesendet: Mittwoch, 22. August 2012 10:11
An: modperl@perl.apache.org
Betreff: Re: Mod_Perl2 getting started

Hi Joe,
have also a look at Frameworks and Interfaces like PSGI or Catalyst.
They provide a more generic way to do these things:

"parsed request, handles args as querystrings and Post data, uploads a file or two, and returns an html page to the requestor"

that way you can use mod_perl in the background wich give you the flexibility to switch to other Interfaces (e.g. fcgi) and servers on need.

best regards

keywan

Am 21.08.2012 23:13, schrieb Randolf Richardson:

Hi,
I´m finding the online documentation regarding mod_perl2 confusing
with regards to all the various modules dealing with request structures etc:
APR::Request, Apache2::Request, Apache2::RequestRec, Apache2::Upload,
etc.
Does anyone know of a tutorial or example code that sorts these out?
Ideally a simple one module working code response handler that illustrates access to the
parsed request, handles args as querystrings and Post data, uploads a file or
two, and returns an html page to the requestor. Anyone have something like that?
Thanks very much in advance,
Joe N


        Hi Joe.  I wrote one guide that has helped a few people get started:

                http://www.modperl.pl/how-to/

        It's still a work-in-progress, and although it doesn't show you
everything that you're asking for, it will get you started.

        Accessing query strings is covered in the Apache::Request module
documentation -- "param" is the keyword to search for.  I recommend
that you develop a clear understanding of how this works before
tackling file uploads, because it will make the learning process with
regard to handling file uploads a lot easier.

Randolf Richardson - randolf@inter-corporate.com<ma...@inter-corporate.com>
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
http://www.inter-corporate.com/





--
Keywan Ghadami
Entwicklung
ibson
Fritz-Arnold-Str. 23
78467 Konstanz
Tel.: +49 (0)75 31 / 81 39 7 93
Fax: +49 (0)75 31 / 81 39 7 89
E-Mail: info@ibson.com<ma...@ibson.com>
Web: www.ibson.com<http://www.ibson.com/>
QuickLinks: Produkte<http://www.ibson.com/Produkte> | Lösungen<http://www.ibson.com/Loesungen> | Services & Support<http://www.ibson.com/Services> | News<http://www.ibson.com/News> | Kunden & Referenzen<http://www.ibson.com/Referenzen> | Kontakt<http://www.ibson.com/Kontakt>

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das Kopieren sowie die Weitergabe dieser E-Mail ist nicht gestattet.

This E-Mail contains confidential and/or legally protected information. If you are not the correct addressee or have received this E-Mail erroneously, please inform the sender immediately and delete this E-Mail. The copying as well as the transmitting of this E-Mail is not permitted


Re: Mod_Perl2 getting started

Posted by Keywan Ghadami <k....@ibson.com>.
Hi Joe,
have also a look at Frameworks and Interfaces like PSGI or Catalyst.
They provide a more generic way to do these things:

"parsed request, handles args as querystrings and Post data, uploads a 
file or two, and returns an html page to the requestor"

that way you can use mod_perl in the background wich give you the 
flexibility to switch to other Interfaces (e.g. fcgi) and servers on need.

best regards

keywan

Am 21.08.2012 23:13, schrieb Randolf Richardson:
>> Hi,
>> I´m finding the online documentation regarding mod_perl2 confusing
>> with regards to all the various modules dealing with request structures etc:
>> APR::Request, Apache2::Request, Apache2::RequestRec, Apache2::Upload,
>> etc.
>> Does anyone know of a tutorial or example code that sorts these out?
>> Ideally a simple one module working code response handler that illustrates access to the
>> parsed request, handles args as querystrings and Post data, uploads a file or
>> two, and returns an html page to the requestor. Anyone have something like that?
>> Thanks very much in advance,
>> Joe N
> 	Hi Joe.  I wrote one guide that has helped a few people get started:
>
> 		http://www.modperl.pl/how-to/
>
> 	It's still a work-in-progress, and although it doesn't show you
> everything that you're asking for, it will get you started.
>
> 	Accessing query strings is covered in the Apache::Request module
> documentation -- "param" is the keyword to search for.  I recommend
> that you develop a clear understanding of how this works before
> tackling file uploads, because it will make the learning process with
> regard to handling file uploads a lot easier.
>
> Randolf Richardson -randolf@inter-corporate.com
> Inter-Corporate Computer & Network Services, Inc.
> Beautiful British Columbia, Canada
> http://www.inter-corporate.com/
>
>


-- 
Keywan Ghadami
Entwicklung
ibson
Fritz-Arnold-Str. 23
78467 Konstanz
Tel.: +49 (0)75 31 / 81 39 7 93
Fax: +49 (0)75 31 / 81 39 7 89
E-Mail: info@ibson.com <ma...@ibson.com>
Web: www.ibson.com <http://www.ibson.com/>
QuickLinks: Produkte <http://www.ibson.com/Produkte> | Lösungen 
<http://www.ibson.com/Loesungen> | Services & Support 
<http://www.ibson.com/Services> | News <http://www.ibson.com/News> | 
Kunden & Referenzen <http://www.ibson.com/Referenzen> | Kontakt 
<http://www.ibson.com/Kontakt>

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte 
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese 
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den 
Absender und vernichten Sie diese E-Mail. Das Kopieren sowie die 
Weitergabe dieser E-Mail ist nicht gestattet.

This E-Mail contains confidential and/or legally protected information. 
If you are not the correct addressee or have received this E-Mail 
erroneously, please inform the sender immediately and delete this 
E-Mail. The copying as well as the transmitting of this E-Mail is not 
permitted


Re: Mod_Perl2 getting started

Posted by Randolf Richardson <ra...@modperl.pl>.
> Hi,
> I´m finding the online documentation regarding mod_perl2 confusing
> with regards to all the various modules dealing with request structures etc:
> APR::Request, Apache2::Request, Apache2::RequestRec, Apache2::Upload,
> etc.
> Does anyone know of a tutorial or example code that sorts these out?
> Ideally a simple one module working code response handler that illustrates access to the 
> parsed request, handles args as querystrings and Post data, uploads a file or
> two, and returns an html page to the requestor. Anyone have something like that?
> Thanks very much in advance,
> Joe N

	Hi Joe.  I wrote one guide that has helped a few people get started:

		http://www.modperl.pl/how-to/

	It's still a work-in-progress, and although it doesn't show you 
everything that you're asking for, it will get you started.

	Accessing query strings is covered in the Apache::Request module 
documentation -- "param" is the keyword to search for.  I recommend 
that you develop a clear understanding of how this works before 
tackling file uploads, because it will make the learning process with 
regard to handling file uploads a lot easier.

Randolf Richardson - randolf@inter-corporate.com
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
http://www.inter-corporate.com/