darkwater23 has asked for the wisdom of the Perl Monks concerning the following question:
Hello!
I'm trying to migrate a site over to an Apache2 server from an Apache1 server. The perl cookie handling pieces of code are not quite working. Here's the error I get:
Can't locate object method "fetch" via package "Apache2::Cookie" (perhaps you forgot to load "Apache2::Cookie"?) at /usr/local/apache/htdocs/autohandler line 6.Our site uses Mason. The block of code causing trouble is below. Per the documentation on CPAN, I added the $r object and changed the name of the packages referenced in the code. When I received the can't locate "fetch" error, I had the server admin check the installation and update the packages again. He insists that Apache2::Cookie is available. Assuming it is, is there anything is this code that would cause the error?
<%init> local *session; if ($r->uri =~ m/product|faq|finder|broadmarket|msp/gi) { my %c = Apache2::Cookie->fetch($r); my $session_id = exists $c{session_} ? $c{session_}->value : undef; eval { tie %session, 'Apache2::Session::File', $session_id, { Directory => '/var/sessions/data', LockDirectory => '/var/sessions/lock', }; }; if ($@) { die $@ unless $@ =~ /Object does not exist/; # Re-throw $m->redirect('/index.html'); } #expires => '+20m', Apache2::Cookie->new( $r, name => 'session_', value => $session{_session_id}, path => '/', )->bake; } #$m->out($r->as_string); $m->call_next; </%init>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Convert Apache1 perl to Apache2
by dtr (Scribe) on Sep 21, 2006 at 18:30 UTC | |
|
Re: Convert Apache1 perl to Apache2
by perrin (Chancellor) on Sep 21, 2006 at 18:47 UTC |