File: Cookies.pm

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (42 lines) | stat: -rw-r--r-- 1,131 bytes parent folder | download | duplicates (7)
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
package TestApp::Controller::Engine::Response::Cookies;

use strict;
use base 'Catalyst::Controller';

sub one : Local {
    my ( $self, $c ) = @_;
    $c->res->cookies->{catalyst} = { value => 'cool',     path => '/bah' };
    $c->res->cookies->{cool}     = { value => 'catalyst', path => '/' };
    $c->forward('TestApp::View::Dump::Request');
}

sub two : Local {
    my ( $self, $c ) = @_;
    $c->res->cookies->{catalyst} = { value => 'cool',     path => '/bah' };
    $c->res->cookies->{cool}     = { value => 'catalyst', path => '/' };
    $c->res->redirect('http://www.google.com/');
}

sub three : Local {
    my ( $self, $c ) = @_;

    $c->res->cookies->{object} = CGI::Simple::Cookie->new(
        -name => "this_is_the_real_name",
        -value => [qw/foo bar/],
    );

    $c->res->cookies->{hash} = {
        value => [qw/a b c/],
    };

    $c->forward('TestApp::View::Dump::Request');
}

sub four : Local {
    my ( $self, $c ) = @_;
    $c->res->cookies->{good} = { value => 'good_cookie', path => '/' };
    $c->res->cookies->{bad} = { value => undef };
    $c->forward('TestApp::View::Dump::Request');
}

1;