Re: Apache::Cookie problems

2000-04-09 Thread Rajesh Kumar Mallah


perldoc Apache::Cookie says

   value
   Get or set the values of the cookie:

1.my $value = $cookie->value;
2.my @values = $cookie->value;

3.$cookie->value("string");
4.$cookie->value(\@array); 

so if you set  a array ref in 4 you retrieve it as in 2
extrapolating that I hope if you set a hash ref with value
you should get a hash back with value. The the same happens.

the following two snippets (set and get cookie) demonstrates
that>





set-cookie.html
---
<% value
   

use Apache;
use Apache::Cookie;

my $hash_ref = {
 'AGE' => 30,
 'SEX' => 'M'
   };
my $r = Apache->request;

my $c = Apache::Cookie->new($r,
-name=> 'conf',
-value   => $hash_ref,
-expires => '+30m',
-path=> '/'
   );
$c->bake;
%>
---


get-cookie.html
--
<%
use Apache::Cookie;
my $cookie_ref = Apache::Cookie->fetch;
my $conf_cookie = $cookie_ref->{conf};
my %hash  = $conf_cookie->value;
my $hash_ref = \%hash;
%>


cookie 'conf'  has value <% print $conf_cookie %> 
hash reference is <% print $hash_ref %> 
content of cookie:
AGE: <% print $hash{'AGE'} %>
SEX: <% print $hash{'SEX'} %>



Alvar Freude wrote:
> 
> Hi,
> 
> I have some problems in setting and getting back Cookie Values with
> Apache::Cookie.
> 
> I'm setting a cookie with Apache::Cookie and it seems that the cookie is
> set correct:
> 
> my $c = Apache::Cookie->new($r,
> -name=> 'conf',
> -value   => $hash_ref,
> -expires => '+30D',
> -path=> '/'
> );
> $c->bake;
> 
> But while Recovering the Cookie I got some errors:
> 
> $cookie_ref = Apache::Cookie->fetch;
> 
> Now $cookoe_ref->{conf} contains not a reference to the old values, it
> contains a skalar like "Apache::Cookie=SCALAR(0x8b675b8)", but no
> hashref ...
> 
> Whats going on? It seems that I'm too stupid, argl!
> 
> The CGI::Cookie-POD only sais:
> 
>fetch returns an associative array consisting of all
>cookies returned by the browser.  The keys of the array
>are the cookie names.
> 
> OK, OK, but what's with the Values of the Hash?
> How can I get the Cookie Values back?
> 
> Whats going wrong?
> 
> Thanx and Ciao
>   Alvar



Re: Apache::DBI problem..

2000-04-04 Thread Rajesh Kumar Mallah




Did you install DBD ?? fro the particular database you installed.
eg for mysql install

cpan> install Bundle::DBD::mysql





Rajesh Kumar Mallah
---
Learning Universe Pvt. Ltd.
59 Mandakini, GK IV, New Delhi 110019
Tel: (91-11) 6412100, 6480342, 6480365
http://www.egurucool.com
email: [EMAIL PROTECTED]
---