FAQ
I am still trying to fathom the API.

I have struck a snag with the documentation.


https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
says....

   use Apache2::Connection ();
   use Apache2::RequestRec ();

   my $c = $r->connection;


What is $r?

I am missing something obvious, what is the context here I do not get?

cheers
Worik
--
The only true evil is turning people into things....
                                          Granny Weatherwax
        worik.stanton@gmail.com 021-1680650, (03) 4821804
                           Aotearoa (New Zealand)

Search Discussions

  • Perrin Harkins at May 16, 2014 at 7:00 pm
    The $r there is the Apache2::RequestRec object. It gets passed to
    your handler. See the handler example in the overview:
    https://perl.apache.org/docs/2.0/user/intro/start_fast.html

    - Perrin
    On Wed, May 14, 2014 at 7:52 PM, Worik Stanton wrote:
    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    I am missing something obvious, what is the context here I do not get?

    cheers
    Worik
    --
    The only true evil is turning people into things....
    Granny Weatherwax
    worik.stanton@gmail.com 021-1680650, (03) 4821804
    Aotearoa (New Zealand)
  • Worik Stanton at May 16, 2014 at 4:18 pm

    On 15/05/14 23:55, Perrin Harkins wrote:
    The $r there is the Apache2::RequestRec object. It gets passed to
    your handler. See the handler example in the overview:
    https://perl.apache.org/docs/2.0/user/intro/start_fast.html
    Thank-you.

    That looks very useful. I can see where it was linked to now from the
    documentation at perl.apache.org.

    Now I can see what I was missing, a "handler" method from a registered
    module

    Worik

    - Perrin
    On Wed, May 14, 2014 at 7:52 PM, Worik Stanton wrote:
    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    I am missing something obvious, what is the context here I do not get?

    cheers
    Worik
    --
    The only true evil is turning people into things....
    Granny Weatherwax
    worik.stanton@gmail.com 021-1680650, (03) 4821804
    Aotearoa (New Zealand)
    .

    --
    The only true evil is turning people into things....
                                              Granny Weatherwax
            worik.stanton@gmail.com 021-1680650, (03) 4821804
                               Aotearoa (New Zealand)
  • Samuel Gómez at May 16, 2014 at 7:25 pm
    I think it is a RequestRec object. But also I think it should be explicitly
    stated.

    On Thu, May 15, 2014 at 1:52 AM, Worik Stanton wrote:

    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    I am missing something obvious, what is the context here I do not get?

    cheers
    Worik
    --
    The only true evil is turning people into things....
    Granny Weatherwax
    worik.stanton@gmail.com 021-1680650, (03) 4821804
    Aotearoa (New Zealand)
  • Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 at May 16, 2014 at 7:25 pm
  • Steven Siebert at May 16, 2014 at 10:18 pm
    $r is a Apache2::RequestRec instance.
    On Wed, May 14, 2014 at 7:52 PM, Worik Stanton wrote:
    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    I am missing something obvious, what is the context here I do not get?

    cheers
    Worik
    --
    The only true evil is turning people into things....
    Granny Weatherwax
    worik.stanton@gmail.com 021-1680650, (03) 4821804
    Aotearoa (New Zealand)
  • Jie Gao at May 16, 2014 at 10:38 pm

    * Worik Stanton wrote:

    Date: Thu, 15 May 2014 11:52:39 +1200
    From: Worik Stanton <worik.stanton@gmail.com>
    To: mod_perl list <modperl@perl.apache.org>
    Subject: API Docs
    User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101
    Thunderbird/24.5.0

    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?
    It is a reference to an Apache request_rec object.


    Regards,


    Jie
    I am missing something obvious, what is the context here I do not get?

    cheers
    Worik
    --
    The only true evil is turning people into things....
    Granny Weatherwax
    worik.stanton@gmail.com 021-1680650, (03) 4821804
    Aotearoa (New Zealand)
  • André Warnier at May 16, 2014 at 10:39 pm

    Worik Stanton wrote:
    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    I am missing something obvious, what is the context here I do not get?
    Hi.

    Maybe you should start here :
    https://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_

    $r is the "current request object". How you obtain it varies a bit depending on where you
    are (in a mod_perl handler, in a cgi-bin script etc..).
    Usually, you'll be in some kind of handler() sub, and the usual idiom then is just

    sub handler {
       my $r = shift;
    ..
    }

    as the request object is the first and usually the only parameter passed in such a sub/method.
    It is also usually the starting point for everything else in mod_perl.

    If you are a real beginner, a recommendation : persist, you'll soon get the hang of it,
    and it's worth the effort. Perl is fun; Apache + mod_perl is *a lot* of fun, and
    incredibly powerful.
  • Worik Stanton at May 17, 2014 at 6:27 am

    On 16/05/14 21:09, André Warnier wrote:
    Maybe you should start here :
    https://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_
    Thank you. That is very useful

    Worik

    --
    The only true evil is turning people into things....
                                              Granny Weatherwax
            worik.stanton@gmail.com 021-1680650, (03) 4821804
                               Aotearoa (New Zealand)
  • André Warnier at May 17, 2014 at 10:39 am

    Worik Stanton wrote:
    On 16/05/14 21:09, André Warnier wrote:
    Maybe you should start here :
    https://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_
    Thank you. That is very useful
    Welcome.
    One thing which you cannot complain about apparently, is the number of answers you're
    getting. mod_perl advocacy seems alive and well.
    Don't hesitate to ask if you have further questions.

    Let me also point you to a couple of other sources of information which I have found
    useful in learning Apache and mod_perl (and later ever again as a reference):

    http://www.modperlcookbook.org/chapters/part3.pdf
    (the schema on page 378)

    in conjunction with :
    https://perl.apache.org/docs/2.0/user/handlers/intro.html#mod_perl_Handlers_Categories

    The point is : Apache httpd does not need to be presented anymore : it is the most widely
    used webserver on the WWW, and it has a very stable, very optimised code base, and a
    plethora of capabilities.
    Apache httpd handles each request in a series of well-defined consecutive steps, each step
    doing something specific in terms of interpreting the request, possibly transforming it,
    checking access permissions, then executing the request in order to generate a certain
    content, then cleaning up and logging.
    Each of these Apache steps offers "hooks", into which you can attach your own code, to
    have it executed by Apache, to modify or replace what the native Apache code would
    normally do at that stage.
    mod_perl allows you to attach your own perl code to any of these hooks, in a simple and
    dynamic way, so that you can - if you wish - take almost complete control of what Apache
    does with any given request.
    And because this is perl, you can try out something in a matter of minutes, using the vast
    CPAN library of perl modules to help you do complex things in a simple way.
    And you can leave all the sordid details that you do not want to deal with, to the
    efficient and hyper-reliable Apache httpd code base.
    That's the real beauty of it.
    In addition, because mod_perl embeds a perl interpreter and run-time into Apache itself,
    and it pre-compiles everything that you add, it is also fast.
    The only drawback is memory usage. But then, if you compare this to java-based
    webservers, there is still a comfortable margin.
  • Jie Gao at May 19, 2014 at 12:17 am

    * André Warnier wrote:

    Date: Sat, 17 May 2014 11:59:24 +0200
    From: André Warnier <aw@ice-sa.com>
    To: mod_perl list <modperl@perl.apache.org>
    Subject: Re: API Docs
    User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)

    Worik Stanton wrote:
    On 16/05/14 21:09, André Warnier wrote:
    Maybe you should start here :
    https://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_
    Thank you. That is very useful
    Welcome.
    One thing which you cannot complain about apparently, is the number
    of answers you're getting. mod_perl advocacy seems alive and well.
    Don't hesitate to ask if you have further questions.
    ...
    I think it was because list mail was being held up somewhere, and people
    thought nobody had replied.

    It was interesting to see the variety of responses to the question. :-)

    I have certainly learnt something from them.

    Regards,



    Jie
  • Randolf Richardson at May 16, 2014 at 10:51 pm

    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?
      Your code needs to start with the following:

       my $r = shift;

      It's basically just Apache2::RequestRec being passed through by
    Apache HTTPd thanks to ModPerl.

    [End of reply.]
    I am missing something obvious, what is the context here I do not get?

    cheers
    Worik
    --
    The only true evil is turning people into things....
    Granny Weatherwax
    worik.stanton@gmail.com 021-1680650, (03) 4821804
    Aotearoa (New Zealand)

    Randolf Richardson - randolf@inter-corporate.com
    Inter-Corporate Computer & Network Services, Inc.
    Beautiful British Columbia, Canada
    http://www.inter-corporate.com/
  • Ken Peng at May 16, 2014 at 11:12 pm
    $r stands for the connection handle IMO.
    Most like the $dbh in a database connection.

    On Thu, May 15, 2014 at 7:52 AM, Worik Stanton wrote:

    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    I am missing something obvious, what is the context here I do not get?

    cheers
    Worik
    --
    The only true evil is turning people into things....
    Granny Weatherwax
    worik.stanton@gmail.com 021-1680650, (03) 4821804
    Aotearoa (New Zealand)
  • Clément OUDOT at May 16, 2014 at 11:12 pm

    2014-05-15 1:52 GMT+02:00 Worik Stanton <worik.stanton@gmail.com>:

    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    I am missing something obvious, what is the context here I do not get?

    $r is the current Apache request.


    Clément.
  • Holger Kipp at May 16, 2014 at 11:59 pm

    Am 15.05.2014 um 01:52 schrieb Worik Stanton <worik.stanton@gmail.com>:

    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    $r is the Apache2::RequestRec object
    $c is the Apache2::Connection object

    it is in the documentation for connection method:
    ---
    connection

    Get the client connection record

    $c = $r->connection();
      • obj: $r ( Apache2::RequestRec object )
      • ret: $c ( Apache2::Connection object )
      • since: 2.0.00



    Best regards,
    Holger
  • Scott Lo at May 17, 2014 at 4:42 am
    Remove me from the mail list please

    Holger Kipp <holger.kipp@alogis.com> 於 2014年5月16日星期五寫道:
    Am 15.05.2014 um 01:52 schrieb Worik Stanton <worik.stanton@gmail.com<javascript:;>
    :
    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    $r is the Apache2::RequestRec object
    $c is the Apache2::Connection object

    it is in the documentation for connection method:
    ---
    connection

    Get the client connection record

    $c = $r->connection();
    • obj: $r ( Apache2::RequestRec object )
    • ret: $c ( Apache2::Connection object )
    • since: 2.0.00



    Best regards,
    Holger

    --
    Best Regards,

    Scott Lo
  • Holger Kipp at May 17, 2014 at 12:04 am
    Dear Worik,

    Am 15.05.2014 um 01:52 schrieb Worik Stanton <worik.stanton@gmail.com>:
    I am still trying to fathom the API.

    I have struck a snag with the documentation.


    https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis
    says....

    use Apache2::Connection ();
    use Apache2::RequestRec ();

    my $c = $r->connection;


    What is $r?

    $r is the Apache2::RequestRec object
    $c is the Apache2::Connection object

    it is in the documentation for connection method:
    ---
    connection

    Get the client connection record

    $c = $r->connection();
             • obj: $r ( Apache2::RequestRec object )
             • ret: $c ( Apache2::Connection object )
             • since: 2.0.00



    Best regards,
    Holger


    __________________________________________________________

    Holger Kipp
    Diplom-Mathematiker
    Senior Consultant

    Tel. : +49 30 436 58 114
    Fax. : +49 30 436 58 214
    Mobil: +49 178 36 58 114
    Email: holger.kipp@alogis.com

    alogis AG
    Alt-Moabit 90b
    D-10559 Berlin

    http://www.alogis.com
    __________________________________________________________

    alogis AG
    Sitz/Registergericht: Berlin/AG Charlottenburg, HRB 71484
    Vorstand: Arne Friedrichs, Joern Samuelson
    Aufsichtsratsvorsitzender: Reinhard Mielke

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmodperl @
categoriesmodperl, perl
postedMay 15, '14 at 6:26a
activeMay 19, '14 at 12:17a
posts17
users12
websiteperl.apache.org

People

Translate

site design / logo © 2018 Grokbase