File: api3_file.t

package info (click to toggle)
libcgi-session-perl 4.48-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 616 kB
  • sloc: perl: 1,920; makefile: 5
file content (56 lines) | stat: -r--r--r-- 1,087 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# $Id: api3_file.t,v 1.3.4.1 2003/07/26 13:37:36 sherzodr Exp $

use strict;


BEGIN {     
    use Test::More;
    plan(tests => 17); 
    use_ok('CGI::Session');
};

my $s = CGI::Session->new("dr:File;ser:Default;id:MD5", undef, {Directory=>"t"} );

ok($s);
    
ok($s->id);

$s->param(author=>'Sherzod Ruzmetov', name => 'CGI::Session', version=>'1'   );

ok($s->param('author'));

ok($s->param('name'));

ok($s->param('version'));


$s->param(-name=>'email', -value=>'sherzodr@cpan.org');

ok($s->param(-name=>'email'));

ok(!$s->expire() );

$s->expire("+10m");

ok($s->expire());

my $sid = $s->id();

$s->flush();

my $s2 = CGI::Session->new(undef, $sid, {Directory=>'t'});
ok($s2);

ok($s2->id() eq $sid);

ok( $s2->param('email'),  "found email param in session");
ok( $s2->param('author'), "found author param in session");
ok( $s2->expire() );

eval { $s2->clear('email'); };
is($@, '', '$s->clear("name") survives eval');
ok(($s2->param('email') ? 0 : 1), "email param is cleared from session");
ok($s2->param('author'), "author param is still in session");

$s2->delete();