It seems if I say
in the setup method in my CGI::Application the sessions are created in $some_dir, Great.my $S = new CGI::Session(undef,undef,{Directory=>"$some_dir"});
But wait, If I make $S global to my application module (i.e. use vars qw/$S/;) the sessions get created in the C:\ directory. Windows perversions and why I would make this a global variable aside, the really peculiar thing (to me) is if I test this program with WWW::Mechinize the sessions get put in $some_dir.
What am I missing about sessions?
##### huh.pl #! Perl use lib 'C:\cgi-bin\Plot2'; use Plot2; Plot2->new()->run; ##### Plot2.pm #! Perl package Plot2; use warnings; use strict; use CGI::Session; use base qw/CGI::Application/; use vars qw/ $HOME $S/; $HOME = 'C:\cgi-bin\Plot2'; sub setup { my $self = shift; $S = new CGI::Session( undef,undef, {Directory => "$HOME/sessions"} ); my $cookie = $self->query->cookie( -name => $S->nane, -value => $S->id); $self->header_props( -cookie => $cookie ); $self->start_mode('page1'); $self->run_modes('page1' => 'page1' ); } sub page1 {'huh';} 1; #### t.pl ! Perl use warnings; use strict; use Test::More qw/no_plan/; use WWW::Mechanize; my $m = WWW::Mechanize->new(); $m->get( 'http://127.0.0.1/cgi-bin/huh.pl' ); like( $m->content(), qr/huh/, "Got expected login" );
In reply to CGI::Application & CGI::Session by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |