File Coverage

lib/Drogo/Cookie.pm
Criterion Covered Total %
statement 6 15 40.0
branch n/a
condition n/a
subroutine 2 5 40.0
pod 3 3 100.0
total 11 23 47.8


line stmt bran cond sub pod time code
1             package Drogo::Cookie;
2              
3 1     1   4 use strict;
  1         2  
  1         29  
4              
5 1     1   839 use CGI::Cookie;
  1         11985  
  1         218  
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             {
25 0     0 1   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             {
39 0     0 1   my ($self, %params) = @_;
40              
41 0           $self->{server}->header_set(
42             '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             {
55 0     0 1   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
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;