File: TestApp.pm

package info (click to toggle)
libdancer2-session-cookie-perl 0.009-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 172 kB
  • sloc: perl: 241; xml: 118; makefile: 2
file content (51 lines) | stat: -rw-r--r-- 993 bytes parent folder | download | duplicates (2)
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
package TestApp;

use Dancer2;

get '/no_session_data' => sub {
    return "session not modified";
};

get '/set_session/*' => sub {
    my ($name) = splat;
    session name => $name;
};

get '/read_session' => sub {
    my $name = session('name') || '';
    "name='$name'";
};

get '/change_session_id' => sub {
    if ( app->can('change_session_id') ) {
        app->change_session_id;
        return "change_session_id supported by Dancer2";
    }
    else {
        return "change_session_id not supported by Dancer2";
    }
};

get '/destroy_session' => sub {
    my $name = session('name') || '';
    app->destroy_session;
    return "destroyed='$name'";
};

get '/churn_session' => sub {
    app->destroy_session;
    session name => 'damian';
    return "churned";
};

#setting appdir => $tempdir;
#setting( engines => { session => { $engine => $config } } );
#setting( session => $engine );

set(
    show_errors  => 1,
    startup_info => 0,
    environment  => 'production',
);

1;