You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Brian Lavender <br...@brie.com> on 2002/03/11 23:08:10 UTC

Can't locate TIEHASH Apache::Session::Oracle

I am trying to test the Apache::Session::Oracle

Here is the error I am getting. What is wrong? I was able to
successfully install and test Apache::Session which tested 
Apache::Session::Oracle

This is the error.

[Mon Mar 11 14:01:23 2002] [error] Can't locate object method "TIEHASH" via package "Apache::Session::Oracle" at /opt/apache/perl/example.perl line 33.

This is the code I am testing.

use strict;
use Apache;
use CGI;
use Apache::Session::File;

my $db_user = 'user';
my $db_pass = 'pass';

my $r = Apache->request();

$r->status(200);
$r->content_type("text/html");

my $session_id = $r->path_info();
$session_id =~ s/^\///;

$session_id = $session_id ? $session_id : undef;

my %session;

tie %session, 'Apache::Session::Oracle', $session_id, {
       DataSource => 'dbi:Oracle:sgum',
       UserName   => $db_user,
       Password   => $db_pass,
       Commit     => 1
      };

my $input = CGI::param('input');
$session{name} = $input if $input;

print<<__EOS__;

Hello<br>
Session ID number is: $session{_session_id}<br>
The Session ID is embedded in the URL<br>
<br>
Your input to the form was: $input<br>
Your name is <b>$session{name}</b><br>

<br>
<a href="http://penguin:8080/perl/example.perl/$session{_session_id}">Reload this session</a><br>
<a href="http://penguin:8080/perl/example.perl">New session</a>

<form action="http://penguin:8080/perl/example.perl/$session{_session_id}" method="post">
  Type in your name here:
  <input name="input">
  <input type="submit" value="Go!">
</form>
__EOS__

-- 
Brian Lavender
http://www.brie.com/brian/

Re: Can't locate TIEHASH Apache::Session::Oracle

Posted by Brian Lavender <br...@brie.com>.
On Mon, Mar 11, 2002 at 02:08:10PM -0800, Brian Lavender wrote:
> I am trying to test the Apache::Session::Oracle
> 
> Here is the error I am getting. What is wrong? I was able to
> successfully install and test Apache::Session which tested 
> Apache::Session::Oracle
> 
> This is the error.
> 
> [Mon Mar 11 14:01:23 2002] [error] Can't locate object method "TIEHASH" via package "Apache::Session::Oracle" at /opt/apache/perl/example.perl line 33.
> 
> This is the code I am testing.
> 
> use strict;
> use Apache;
> use CGI;
> use Apache::Session::File;

Hmm, odd how I have a problem, and in the process of posting my question,
I figure it out. The above line just needs to be changed to:

use Apache::Session::Oracle;

and voila, it works.

brian
-- 
Brian Lavender
http://www.brie.com/brian/

Re: Can't locate TIEHASH Apache::Session::Oracle

Posted by "Mark P. Fister" <mf...@ebay.com>.
On Mon, Mar 11, 2002 at 02:08:10PM -0800, Brian Lavender wrote:
> I am trying to test the Apache::Session::Oracle
> 
> Here is the error I am getting. What is wrong? I was able to
> successfully install and test Apache::Session which tested 
> Apache::Session::Oracle
> 
> This is the error.
> 
> [Mon Mar 11 14:01:23 2002] [error] Can't locate object method "TIEHASH" via package "Apache::Session::Oracle" at /opt/apache/perl/example.perl line 33.
> 
> This is the code I am testing.
> 
> use strict;
> use Apache;
> use CGI;
> use Apache::Session::File;

use Apache::Session::Oracle;

> my $db_user = 'user';
> my $db_pass = 'pass';
> 
> my $r = Apache->request();
> 
> $r->status(200);
> $r->content_type("text/html");
> 
> my $session_id = $r->path_info();
> $session_id =~ s/^\///;
> 
> $session_id = $session_id ? $session_id : undef;
> 
> my %session;
> 
> tie %session, 'Apache::Session::Oracle', $session_id, {
>        DataSource => 'dbi:Oracle:sgum',
>        UserName   => $db_user,
>        Password   => $db_pass,
>        Commit     => 1
>       };
> 
> my $input = CGI::param('input');
> $session{name} = $input if $input;
> 
> print<<__EOS__;
> 
> Hello<br>
> Session ID number is: $session{_session_id}<br>
> The Session ID is embedded in the URL<br>
> <br>
> Your input to the form was: $input<br>
> Your name is <b>$session{name}</b><br>
> 
> <br>
> <a href="http://penguin:8080/perl/example.perl/$session{_session_id}">Reload this session</a><br>
> <a href="http://penguin:8080/perl/example.perl">New session</a>
> 
> <form action="http://penguin:8080/perl/example.perl/$session{_session_id}" method="post">
>   Type in your name here:
>   <input name="input">
>   <input type="submit" value="Go!">
> </form>
> __EOS__
> 
> -- 
> Brian Lavender
> http://www.brie.com/brian/

-- 
\_/} Mark P. Fister             Java, Java, everywhere, and all    \_/}
\_/} eBay, Inc.                 the cups did shrink; Java, Java    \_/}
\_/} Austin, TX                 everywhere, nor any drop to drink! \_/}