File: bug24285.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 (27 lines) | stat: -r-xr-xr-x 695 bytes parent folder | download | duplicates (5)
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
use strict;
use Test::More 'no_plan';

#  This test is about checking {Directory=>/not_tmp} actually works;
#  Reference: http://rt.cpan.org/Public/Bug/Display.html?id=24285

use CGI::Session;
use CGI::Session::Driver;
use CGI::Session::Driver::file;

my $opt_dsn;
my $id;
my $file_name;

 my($dir_name) = File::Spec->catdir('t', 'sessiondata');

{
    $opt_dsn = {Directory=>$dir_name};

    ok(my $s = CGI::Session->new('driver:file;serializer:default', undef, $opt_dsn), 'Created CGI::Session object successfully');

    $id        = $s -> id();
    $file_name = File::Spec->catdir($dir_name, "cgisess_$id");
}

ok(-e $file_name, 'Created file outside /tmp successfully');
unlink $file_name;