File: 03-delete-via-find.t

package info (click to toggle)
libcgi-session-expiresessions-perl 1.08-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 104 kB
  • ctags: 17
  • sloc: perl: 260; makefile: 44
file content (42 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl

use strict;
use diagnostics;

BEGIN
{
	use CGI::Session;
	use CGI::Session::ExpireSessions;
	use Test::More;

	if (CGI::Session -> can('find') )
	{
		plan tests => 3;
	}
	else
	{
		plan skip_all => "Requires a version of CGI::Session with method 'find()'";
	}
};

# Create a block so $s goes out of scope before we try to access the session.
# Without the {}, CGI::Session::ExpireSessions does not see this session,
# although it will see sessions created by previous runs of this program.

{
	my($s) = new CGI::Session(undef, undef, {Directory => 't'} );

	ok($s, 'The test session has been created');

	$s -> expire(1);

	ok($s -> id, "The test session's id has been set");

	#print "id: ", $s -> id(), ". \n";

	$s -> param(purpose => "Create session simply to test deleting it with CGI::Session's sub find()");

	ok($s -> param('purpose'), "The test session's parameter called 'purpose' has been set");
}

CGI::Session::ExpireSessions -> new(delta => 0, dsn_args => {Directory => 't'}, verbose => 1) -> expire_sessions();