What am I doing wrong? Thanks.
package ImagesAdmin; use base CGI::Application; use strict; use ImagesES::Conf; use CGI::Session; use File::Spec; sub setup { my $self = shift; my $q = $self->query(); $self->param('conf' => ImagesES::Conf->new()); $self->param('session' => new CGI::Session(undef, $q, {Directory => $self->param('conf') +->{'cgi_session_dir'}})); $self->param('session')->expire( $self->param('conf')->{'admin_ses +sion_expire'}); $self->param('this_url' => $q->url(-absolute=>1)); my $cookie = $q->cookie(-name => 'sid', -value => $self->p +aram('session')->id(), -path => $self->pa +ram('conf')->{'admin_cookie_path'}); $self->header_props(-cookie => $cookie); $self->start_mode('mainmenu'); $self->run_modes( mainmenu => 'mainmenu', logout => 'logout', ); } sub mainmenu { my $self = shift; my $q = $self->query(); my $logout_link = $self->param('this_url') . '?rm=logout'; my $output = $q->start_html(); $output .= $q->p( 'your session id is', $self->param('session')->i +d() ); $output .= $q->p( $q->a({href=> $self->param('this_url')}, 'check +it\'s the same') ); $output .= $q->p( $q->a({href=> $logout_link}, 'logout')); $output .= $q->end_html(); return $output; } sub logout { my $self = shift; my $q = $self->query(); $self->param('session')->delete(); my $output = $q->start_html(); $output .= $q->p('logged out!'); $output .= $q->p( $q->a({href=> $self->param('this_url')}, 'log in +') ); $output .= $q->end_html(); return $output; } 1;
2003-06-14 edit ybiC: <readmore> tags around block of code
In reply to CGI::Application CGI::Session problem by fireartist
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |