[ANNOUNCE] CGI::Builder::SessionManager 1.00

From: Enrico Sorcinelli (enrico_at_sorcinelli.it)
Date: 07/29/04

  • Next message: Amir Karger: "Namespace for Z-machine parse/translate module"
    Date: Thu, 29 Jul 2004 15:36:46 GMT
    
    

    The uploaded file

        CGI-Builder-SessionManager-1.00.tar.gz

    has entered CPAN as

      file: $CPAN/authors/id/E/EN/ENRYS/CGI-Builder-SessionManager-1.00.tar.gz
      size: 3459 bytes
       md5: 4c26c6d56afa06ff53bfc464d2cd6d26

    I've included perldoc at the bottom of this mail.

    Any comment and/or criticism are welcome :-)

    by

            - Enrico

    ---
    NAME
        CGI::Builder::SessionManager - CGI::Builder / Apache::SessionManager
        integration
    SYNOPSIS
           package WebApp;
           use CGI::Builder qw/ CGI::Builder::SessionManager /;
           sub PH_session {
              my $cbf = shift;
              $cbf->page_content = 'Session test page!';
              $cbf->sm->{'foo'} = 'baz';
              $cbf->page_content .= $cbf->sm->{'foo'};
           }
    DESCRIPTION
        CGI::Builder::SessionManager is a CGI::Builder extension that integrates
        Apache::SessionManager session management into CGI::Builder framework
        (CBF).
        Apache::SessionManager is a mod_perl (1.0 and 2.0) module that helps
        session management of a web application. This module is a wrapper around
        Apache::Session persistence framework for session data. It creates a
        session object and makes it available to all other handlers
        transparenlty. See 'perldoc Apache::SessionManager' for module
        documentation and use.
    INSTALLATION
        In order to install and use this package you will need Perl version
        5.005 or better.
        Prerequisites:
        * CGI::Builder >= 1.2
        * Apache::SessionManager >= 1.01
        Installation as usual:
           % perl Makefile.PL
           % make
           % make test
           % su
             Password: *******
           % make install
    PROPERTIES
        This module adds "sm" property to the standard CBF properties.
        It's possible to set a value in current session with:
           $cbf->sm->{'foo'} = 'baz';
        and it's possible to read value session with:
           print $cbf->sm->{'foo'};   
    METHODS
      sm_destroy
        Destroy the current session object.
           $cbf->sm_destroy;
    EXAMPLES
        This is a simple CGI::Builder application, (save it, for example, as
        /some/path/cgi-builder/WebApp.pm):
           package WebApp;    # your class name
           use CGI::Builder qw/ CGI::Builder::SessionManager /;
           use Data::Dumper;
      
           sub PH_AUTOLOAD {                           # always called for all requested pages
              my $cbf = shift;
              $cbf->page_content = "Default content";  # defines the page content
           }
           sub PH_session {
              my $cbf = shift;
              $cbf->page_content = "Session test!<BR>\n";
              $cbf->sm->{"$$-" . rand()} = rand;
              $cbf->page_content .= '<PRE>' . Dumper($s->cbf) . '</PRE>';
                }
           sub PH_delete_session {
              my $cbf = shift;
              $cbf->page_content = "Session test! (deletion)";
              $cbf->sm_destroy;
           }
        and the correspondent configuration lines in httpd.conf:
           <IfModule mod_perl.c>
              PerlModule Apache::SessionManager
              PerlTransHandler Apache::SessionManager
              Alias /cgi-builder "/usr/local/apache/cgi-builder"
              <Location /cgi-builder>
                 SetHandler perl-script
                 PerlHandler Apache::Registry
                 PerlSendHeader On
                 PerlSetupEnv   On
                 Options +ExecCGI
                 PerlSetVar SessionManagerTracking On
                 PerlSetVar SessionManagerExpire 1800
                 PerlSetVar SessionManagerInactivity 900
                 PerlSetVar SessionManagerName CBFSESSIONID
                 PerlSetVar SessionManagerStore File
                 PerlSetVar SessionManagerStoreArgs "Directory => /tmp/apache_session_data/cbf"
                 PerlSetVar SessionManagerDebug 1
              </Location>   
           </IfModule>
        In order to test this simple application you must implement the Instance
        Script that is what is actually called by your web server.
        It is a very small, simple file which simply creates an instance of your
        application and calls an inherited method, "process()". Following is the
        entirely of /some/path/cgi-builder/webapp.cgi:
           #!/usr/local/bin/perl -w
           use WebApp;
           my $webapp = new WebApp;
           $webapp->process();
        Restart the httpd server and launch
        *http://localhost/cgi-builder/webapp.cgi* .
    BUGS
        Please submit bugs to CPAN RT system at
        http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Builder-SessionManager
        or by email at bug-cgi-builder-sessionmanager@rt.cpan.org
        Patches are welcome and I'll update the module if any problems will be
        found.
    VERSION
        Version 1.00
    SEE ALSO
        Apache::SessionManager, CGI::Builder
    AUTHOR
        Enrico Sorcinelli, <enrico at sorcinelli.it>
    COPYRIGHT AND LICENSE
        Copyright (C) 2004 by Enrico Sorcinelli
        This library is free software; you can redistribute it and/or modify it
        under the same terms as Perl itself, either Perl version 5.8.2 or, at
        your option, any later version of Perl 5 you may have available.
    

  • Next message: Amir Karger: "Namespace for Z-machine parse/translate module"

    Relevant Pages

    • [ANNOUNCE] CGI::Builder::SessionManager 1.00
      ... Apache::SessionManager session management into CGI::Builder framework ... (CBF). ... In order to install and use this package you will need Perl version ... PerlSetVar SessionManagerTracking On ...
      (comp.lang.perl.modules)
    • Re: Example of web application done right?
      ... I would really not recommend perl for this ... We used perl, and regretted it for the web interface. ... Session ID was a string that contained info about which machine it was on. ... Our web server load balancing was done by DNS, and, thankfully most browsers ...
      (comp.lang.perl.misc)
    • Re: Example of web application done right?
      ... > We used perl, and regretted it for the web interface. ... I much prefer this technique to PHP. ... For session coupling as as well as backend object ...
      (comp.lang.perl.misc)
    • Re: Example of web application done right?
      ... > We used perl, and regretted it for the web interface. ... I much prefer this technique to PHP. ... For session coupling as as well as backend object ...
      (comp.lang.perl.misc)
    • Re: Using Cookies With Perl
      ... k> This isn't a Perl question and has no excuse to be here. ... and get back cookies from a browser via the user agent. ... requires some way of keeping state (the session itself) and some way of ...
      (comp.lang.perl.misc)