Hi, list<br>I got one issue when I use the plugin CGI::Application::Plugin:<div id="1ep2" class="ArwC7c ckChnd">:Session<br><br>I have a parent package(Class), named "FWebApp",<br>and this class extends the CGI::Application.<br>
I did some setting work in the method cgiapp_init<br>
<br>like this:<br><br>sub cgiapp_init {<br> my $this = shift;<br><br> #get the database configuration<br> my $datasource = $this->cfg('data_source');<br> my $data_user = $this->cfg('data_username');<br>
my $data_auth = $this->cfg('data_userauth');<br> my $attr = $this->cfg('data_attr');<br> <br> #configuration the Database<br> $this->dbh_config($datasource,<br> $data_user,<br>
$data_auth, <br> $attr);<br> <br><br> #configuration the Session<br> $this->session_config(<br> CGI_SESSION_OPTIONS => [<br> "driver:mysql",<br> $this->query,<br>
{<br> Handle=>$this->dbh<br> }],<br><br> COOKIE_PARAMS => {<br> -domain => $this->cfg('site_domain'),<br> -expires=>'+40m',<br> -path=>'/',<br>
-secure=>1,<br> },<br><br> );<br><br> #set the template path<br> $this->tmpl_path($this->cfg('template_path'));<br><br><br><br>and the session configuration look like is ok.<br><br>
and so, just now, i assume I have a action: it is register .<br>so, I will write a new module named:<br><br>package FWebApp::Register;<br>=head1 NAME<br><br>FWebApp::Register - show the register page<br><br>=head1 SYNOPSIS<br>
<br>extends the Class FWebApp, <br>show the register page<br><br>=cut<br>use strict;<br>use warnings;<br>use base qw/FWebApp/;<br>use CGI::Application::Plugin::AutoRunmode;<br>use CGI::Application::Plugin::DBH qw/dbh_config dbh/;<br>
use CGI::Application::Plugin::ConfigAuto qw/cfg/;<br>use CGI::Application::Plugin::Session;<br><br><br># the default requirement mode<br># show the register page.<br>sub show_register: StartRunmode {<br> my $this = shift;<br>
<br> # if that user had login, we will jump to home page<br> my $template = undef;<br> if ( $this->session->param('loginname') ) {<br> $template = $this->load_tmpl('had_login.html');<br>
$template->param('HOMEPAGE', 'index.html');<br> } else {<br> $template = $this->load_tmpl('register.html');<br> }<br><br> <br> return $template->output;<br>
<br>}<br><br><br><br><br>1;<br><br><br>it is extends FWebApp, but when I had prepared a script:<br>like this:<br>#!/usr/local/bin/perl -w -T<br>use strict;<br>use lib qw(. ../lib);<br>use CGI::Application::Plugin::ConfigAuto;<br>
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;<br>use FWebApp::Register;<br><br>my $app = FWebApp::Register->new(<br> PARAMS => {<br> cfg_file => 'config.pl' } );<br><br>$app->run;<br>
<br>
<br><u><b>when I refresh that script, we always got the difference session id, why?</b></u><br><br><br>thanks<br><font color="#888888"><br><br>Mike.G</font></div>