| 1 | package Drogo::Cookie; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use CGI::Cookie; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | =head1 MODULE | ||
| 8 | |||
| 9 | Drogo::Cookie | ||
| 10 | |||
| 11 | =head1 METHODS | ||
| 12 | |||
| 13 | =over 4 | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | =item $self->new | ||
| 18 | |||
| 19 | Return cookie dispatcher. | ||
| 20 | |||
| 21 | =cut | ||
| 22 | |||
| 23 | sub new | ||
| 24 | 0 | ▶ | { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 25 | 0 | my ($class, $ns) = @_; | |
| 26 | 0 | my $self = { server => $ns }; | |
| 27 | 0 | bless($self); | |
| 28 | 0 | return $self; | |
| 29 | } | ||
| 30 | |||
| 31 | =item Cookie->set | ||
| 32 | |||
| 33 | Set cookie. | ||
| 34 | |||
| 35 | =cut | ||
| 36 | |||
| 37 | sub set | ||
| 38 | 0 | ▶ | { |
|
Subroutine
set: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 39 | 0 | my ($self, %params) = @_; | |
| 40 | |||
| 41 | $self->{server}->header_set( | ||
| 42 | 0 | 'Set-Cookie', | |
| 43 | new CGI::Cookie(%params)->as_string, | ||
| 44 | ); | ||
| 45 | } | ||
| 46 | |||
| 47 | =item my %params = Cookie->read | ||
| 48 | |||
| 49 | Read all cookies. | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | sub read | ||
| 54 | 0 | ▶ | { |
|
Subroutine
read: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 55 | 0 | my ($self, %params) = @_; | |
| 56 | |||
| 57 | 0 | my $cookies = $self->{server}->header_in('cookie'); | |
| 58 | |||
| 59 | 0 | return parse CGI::Cookie($cookies); | |
| 60 | } | ||
| 61 | |||
| 62 | =head1 AUTHORS | ||
| 63 | |||
| 64 | Bizowie <http://bizowie.com> | ||
| 65 | |||
| 66 | =head1 COPYRIGHT AND LICENSE | ||
| 67 | |||
| 68 | Copyright (C) 2013 Bizowie | ||
| 69 | |||
| 70 | This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | 1 | 1; | |