| 1 | 8 | ▶ | use 5.008001; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||
| 5 | package HTTP::CookieJar; | ||||||||||||||||||||||||||||||||||||
| 6 | # ABSTRACT: A minimalist HTTP user agent cookie jar | ||||||||||||||||||||||||||||||||||||
| 7 | 8 | our $VERSION = '0.014'; | |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 10 | 8 | ▶ | use HTTP::Date (); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||
| 12 | 8 | my $HAS_MPS = eval { require Mozilla::PublicSuffix; 1 }; | |||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||
| 14 | #pod =construct new | ||||||||||||||||||||||||||||||||||||
| 15 | #pod | ||||||||||||||||||||||||||||||||||||
| 16 | #pod my $jar = HTTP::CookieJar->new; | ||||||||||||||||||||||||||||||||||||
| 17 | #pod | ||||||||||||||||||||||||||||||||||||
| 18 | #pod Return a new, empty cookie jar | ||||||||||||||||||||||||||||||||||||
| 19 | #pod | ||||||||||||||||||||||||||||||||||||
| 20 | #pod =cut | ||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||
| 22 | 47 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 23 | 47 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||
| 24 | 47 | bless { store => {} }, $class; | |||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||
| 27 | #pod =method add | ||||||||||||||||||||||||||||||||||||
| 28 | #pod | ||||||||||||||||||||||||||||||||||||
| 29 | #pod $jar->add( | ||||||||||||||||||||||||||||||||||||
| 30 | #pod "http://www.example.com/", "lang=en-US; Path=/; Domain=example.com" | ||||||||||||||||||||||||||||||||||||
| 31 | #pod ); | ||||||||||||||||||||||||||||||||||||
| 32 | #pod | ||||||||||||||||||||||||||||||||||||
| 33 | #pod Given a request URL and a C<Set-Cookie> header string, attempts to adds the | ||||||||||||||||||||||||||||||||||||
| 34 | #pod cookie to the jar. If the cookie is expired, instead it deletes any matching | ||||||||||||||||||||||||||||||||||||
| 35 | #pod cookie from the jar. A C<Max-Age> attribute will be converted to an absolute | ||||||||||||||||||||||||||||||||||||
| 36 | #pod C<Expires> attribute. | ||||||||||||||||||||||||||||||||||||
| 37 | #pod | ||||||||||||||||||||||||||||||||||||
| 38 | #pod It will throw an exception if the request URL is missing or invalid. Returns true if | ||||||||||||||||||||||||||||||||||||
| 39 | #pod successful cookie processing or undef/empty-list on failure. | ||||||||||||||||||||||||||||||||||||
| 40 | #pod | ||||||||||||||||||||||||||||||||||||
| 41 | #pod =cut | ||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||
| 43 | 81 | ▶ | sub add { | ||||||||||||||||||||||||||||||||||
|
Subroutine
add: called CC=14 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 44 | 81 | my ( $self, $request, $cookie ) = @_; | |||||||||||||||||||||||||||||||||||
| 45 | 81 | ▶ | return unless defined $cookie and length $cookie; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $cookie and length $cookie
MC/DC50%1/2
defined $cookie and length $cookie
defined $cookie
length $cookie
Truth table66%2/3
A and B
A= defined $cookieB= length $cookie
| |||||||||||||||||||||||||||||||||||||
| 46 | 80 | my ( $scheme, $host, $port, $request_path ) = eval { _split_url($request) }; | |||||||||||||||||||||||||||||||||||
| 47 | 80 | ▶ | Carp::croak($@) if $@; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||
| 49 | 80 | ▶ | return unless my $parse = _parse_cookie($cookie); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 50 | 79 | my $name = $parse->{name}; | |||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||
| 52 | # check and normalize domain | ||||||||||||||||||||||||||||||||||||
| 53 | 79 | ▶ | if ( exists $parse->{domain} ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 54 | 31 | ▶ | _normalize_domain( $host, $parse ) or return; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||
| 56 | else { | ||||||||||||||||||||||||||||||||||||
| 57 | 48 | $parse->{domain} = $host; | |||||||||||||||||||||||||||||||||||
| 58 | 48 | $parse->{hostonly} = 1; | |||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||
| 60 | 74 | my $domain = $parse->{domain}; | |||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||
| 62 | # normalize path | ||||||||||||||||||||||||||||||||||||
| 63 | 74 | ▶ | if ( !exists $parse->{path} || substr( $parse->{path}, 0, 1 ) ne "/" ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not exists $parse->{"path"} or substr($parse->{"path"}, 0, 1) ne "/"
MC/DC50%1/2
not exists $parse->{"path"} or substr($parse->{"path"}, 0, 1) ne "/"
not exists $parse->{"path"}
substr($parse->{"path"}, 0, 1) ne "/"
Truth table66%2/3
not(A) or B
A= not exists $parse->{"path"}B= substr($parse->{"path"}, 0, 1) ne "/"
| |||||||||||||||||||||||||||||||||||||
| 64 | 34 | $parse->{path} = _default_path($request_path); | |||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||
| 66 | 74 | my $path = $parse->{path}; | |||||||||||||||||||||||||||||||||||
| 67 | # set timestamps and normalize expires | ||||||||||||||||||||||||||||||||||||
| 68 | 74 | my $now = $parse->{creation_time} = $parse->{last_access_time} = time; | |||||||||||||||||||||||||||||||||||
| 69 | 74 | ▶ | if ( exists $parse->{'max-age'} ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 70 | # "If delta-seconds is less than or equal to zero (0), let expiry-time | ||||||||||||||||||||||||||||||||||||
| 71 | # be the earliest representable date and time." | ||||||||||||||||||||||||||||||||||||
| 72 | $parse->{expires} = $parse->{'max-age'} <= 0 | ||||||||||||||||||||||||||||||||||||
| 73 | ? 0 | ||||||||||||||||||||||||||||||||||||
| 74 | 8 | ▶ | : $now + $parse->{'max-age'}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 75 | 8 | delete $parse->{'max-age'}; | |||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||
| 77 | # update creation time from old cookie, if exists | ||||||||||||||||||||||||||||||||||||
| 78 | 74 | ▶ | if ( my $old = $self->{store}{$domain}{$path}{$name} ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 79 | 5 | $parse->{creation_time} = $old->{creation_time}; | |||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||
| 81 | # if cookie has expired, purge any old matching cookie, too | ||||||||||||||||||||||||||||||||||||
| 82 | 74 | ▶ | if ( defined $parse->{expires} && $parse->{expires} < $now ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $parse->{"expires"} and $parse->{"expires"} < $now
MC/DC100%2/2
defined $parse->{"expires"} and $parse->{"expires"} < $now
defined $parse->{"expires"}
$parse->{"expires"} < $now
Truth table100%3/3
A and B
A= defined $parse->{"expires"}B= $parse->{"expires"} < $now
| |||||||||||||||||||||||||||||||||||||
| 83 | 9 | delete $self->{store}{$domain}{$path}{$name}; | |||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||
| 85 | else { | ||||||||||||||||||||||||||||||||||||
| 86 | 65 | $self->{store}{$domain}{$path}{$name} = $parse; | |||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||
| 88 | 74 | return 1; | |||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||
| 91 | #pod =method clear | ||||||||||||||||||||||||||||||||||||
| 92 | #pod | ||||||||||||||||||||||||||||||||||||
| 93 | #pod $jar->clear | ||||||||||||||||||||||||||||||||||||
| 94 | #pod | ||||||||||||||||||||||||||||||||||||
| 95 | #pod Empties the cookie jar. | ||||||||||||||||||||||||||||||||||||
| 96 | #pod | ||||||||||||||||||||||||||||||||||||
| 97 | #pod =cut | ||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||
| 99 | 5 | ▶ | sub clear { | ||||||||||||||||||||||||||||||||||
|
Subroutine
clear: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 100 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||
| 101 | 5 | $self->{store} = {}; | |||||||||||||||||||||||||||||||||||
| 102 | 5 | return 1; | |||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||
| 105 | #pod =method cookies_for | ||||||||||||||||||||||||||||||||||||
| 106 | #pod | ||||||||||||||||||||||||||||||||||||
| 107 | #pod my @cookies = $jar->cookies_for("http://www.example.com/foo/bar"); | ||||||||||||||||||||||||||||||||||||
| 108 | #pod | ||||||||||||||||||||||||||||||||||||
| 109 | #pod Given a request URL, returns a list of hash references representing cookies | ||||||||||||||||||||||||||||||||||||
| 110 | #pod that should be sent. The hash references are copies -- changing values | ||||||||||||||||||||||||||||||||||||
| 111 | #pod will not change the cookies in the jar. | ||||||||||||||||||||||||||||||||||||
| 112 | #pod | ||||||||||||||||||||||||||||||||||||
| 113 | #pod Cookies set C<secure> will only be returned if the request scheme is C<https>. | ||||||||||||||||||||||||||||||||||||
| 114 | #pod Expired cookies will not be returned. | ||||||||||||||||||||||||||||||||||||
| 115 | #pod | ||||||||||||||||||||||||||||||||||||
| 116 | #pod Keys of a cookie hash reference might include: | ||||||||||||||||||||||||||||||||||||
| 117 | #pod | ||||||||||||||||||||||||||||||||||||
| 118 | #pod =for :list | ||||||||||||||||||||||||||||||||||||
| 119 | #pod * name -- the name of the cookie | ||||||||||||||||||||||||||||||||||||
| 120 | #pod * value -- the value of the cookie | ||||||||||||||||||||||||||||||||||||
| 121 | #pod * domain -- the domain name to which the cookie applies | ||||||||||||||||||||||||||||||||||||
| 122 | #pod * path -- the path to which the cookie applies | ||||||||||||||||||||||||||||||||||||
| 123 | #pod * expires -- if present, when the cookie expires in epoch seconds | ||||||||||||||||||||||||||||||||||||
| 124 | #pod * secure -- if present, the cookie was set C<Secure> | ||||||||||||||||||||||||||||||||||||
| 125 | #pod * httponly -- if present, the cookie was set C<HttpOnly> | ||||||||||||||||||||||||||||||||||||
| 126 | #pod * hostonly -- if present, the cookie may only be used with the domain as a host | ||||||||||||||||||||||||||||||||||||
| 127 | #pod * creation_time -- epoch time when the cookie was first stored | ||||||||||||||||||||||||||||||||||||
| 128 | #pod * last_access_time -- epoch time when the cookie was last accessed (i.e. "now") | ||||||||||||||||||||||||||||||||||||
| 129 | #pod | ||||||||||||||||||||||||||||||||||||
| 130 | #pod Keep in mind that C<httponly> means it should only be used in requests and not | ||||||||||||||||||||||||||||||||||||
| 131 | #pod made available via Javascript, etc. This is pretty meaningless for Perl user | ||||||||||||||||||||||||||||||||||||
| 132 | #pod agents. | ||||||||||||||||||||||||||||||||||||
| 133 | #pod | ||||||||||||||||||||||||||||||||||||
| 134 | #pod Generally, user agents should use the C<cookie_header> method instead. | ||||||||||||||||||||||||||||||||||||
| 135 | #pod | ||||||||||||||||||||||||||||||||||||
| 136 | #pod It will throw an exception if the request URL is missing or invalid. | ||||||||||||||||||||||||||||||||||||
| 137 | #pod | ||||||||||||||||||||||||||||||||||||
| 138 | #pod =cut | ||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||
| 140 | 52 | ▶ | sub cookies_for { | ||||||||||||||||||||||||||||||||||
|
Subroutine
cookies_for: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 141 | 52 | my ( $self, $request ) = @_; | |||||||||||||||||||||||||||||||||||
| 142 | 52 | my @found = $self->_cookies_for($request); | |||||||||||||||||||||||||||||||||||
| 143 | 52 | return map { {%$_} } @found; | |||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||
| 146 | # _cookies_for returns originals, not copies, which helps in testing | ||||||||||||||||||||||||||||||||||||
| 147 | 53 | ▶ | sub _cookies_for { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_cookies_for: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||||||||||
| 148 | 53 | my ( $self, $request ) = @_; | |||||||||||||||||||||||||||||||||||
| 149 | 53 | my ( $scheme, $host, $port, $request_path ) = eval { _split_url($request) }; | |||||||||||||||||||||||||||||||||||
| 150 | 53 | ▶ | Carp::croak($@) if $@; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||
| 152 | 53 | my @found; | |||||||||||||||||||||||||||||||||||
| 153 | 53 | my $now = time; | |||||||||||||||||||||||||||||||||||
| 154 | 53 | for my $cookie ( $self->_all_cookies ) { | |||||||||||||||||||||||||||||||||||
| 155 | 79 | ▶ | next if $cookie->{hostonly} && $host ne $cookie->{domain}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$cookie->{"hostonly"} and $host ne $cookie->{"domain"}
MC/DC100%2/2
$cookie->{"hostonly"} and $host ne $cookie->{"domain"}
$cookie->{"hostonly"}
$host ne $cookie->{"domain"}
Truth table100%3/3
A and B
A= $cookie->{"hostonly"}B= $host ne $cookie->{"domain"}
| |||||||||||||||||||||||||||||||||||||
| 156 | 78 | ▶ | next if $cookie->{secure} && $scheme ne 'https'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$cookie->{"secure"} and $scheme ne "https"
MC/DC100%2/2
$cookie->{"secure"} and $scheme ne "https"
$cookie->{"secure"}
$scheme ne "https"
Truth table100%3/3
A and B
A= $cookie->{"secure"}B= $scheme ne "https"
| |||||||||||||||||||||||||||||||||||||
| 157 | 76 | ▶ | next if defined( $cookie->{expires} ) && $cookie->{expires} < $now; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $cookie->{"expires"} and $cookie->{"expires"} < $now
MC/DC0%0/2
defined $cookie->{"expires"} and $cookie->{"expires"} < $now
defined $cookie->{"expires"}
$cookie->{"expires"} < $now
Truth table66%2/3
A and B
A= defined $cookie->{"expires"}B= $cookie->{"expires"} < $now
| |||||||||||||||||||||||||||||||||||||
| 158 | 76 | ▶ | next unless _domain_match( $host, $cookie->{domain} ); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 159 | 66 | ▶ | next unless _path_match( $request_path, $cookie->{path} ); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 160 | 61 | $cookie->{last_access_time} = time; | |||||||||||||||||||||||||||||||||||
| 161 | 61 | push @found, $cookie; | |||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||
| 163 | @found = sort { | ||||||||||||||||||||||||||||||||||||
| 164 | 53 | length( $b->{path} ) <=> length( $a->{path} ) | |||||||||||||||||||||||||||||||||||
| 165 | || $a->{creation_time} <=> $b->{creation_time} | ||||||||||||||||||||||||||||||||||||
| 166 | 30 | ▶ | } @found; | ||||||||||||||||||||||||||||||||||
|
Condition100%3/3
length $HTTP::CookieJar::b->{'path'} <=> length $HTTP::CookieJar::a->{'path'} || $HTTP::CookieJar::a->{'creation_time'} <=> $HTTP::CookieJar::b->{'creation_time'}
MC/DC100%2/2
length $HTTP::CookieJar::b->{'path'} <=> length $HTTP::CookieJar::a->{'path'} || $HTTP::CookieJar::a->{'creation_time'} <=> $HTTP::CookieJar::b->{'creation_time'}
length $HTTP::CookieJar::b->{'path'} <=> length $HTTP::CookieJar::a->{'path'}
$HTTP::CookieJar::a->{'creation_time'} <=> $HTTP::CookieJar::b->{'creation_time'}
Truth table100%3/3
A || B
A= length $HTTP::CookieJar::b->{'path'} <=> length $HTTP::CookieJar::a->{'path'}B= $HTTP::CookieJar::a->{'creation_time'} <=> $HTTP::CookieJar::b->{'creation_time'}
| |||||||||||||||||||||||||||||||||||||
| 167 | 53 | return @found; | |||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||
| 170 | #pod =method cookie_header | ||||||||||||||||||||||||||||||||||||
| 171 | #pod | ||||||||||||||||||||||||||||||||||||
| 172 | #pod my $header = $jar->cookie_header("http://www.example.com/foo/bar"); | ||||||||||||||||||||||||||||||||||||
| 173 | #pod | ||||||||||||||||||||||||||||||||||||
| 174 | #pod Given a request URL, returns a correctly-formatted string with all relevant | ||||||||||||||||||||||||||||||||||||
| 175 | #pod cookies for the request. This string is ready to be used in a C<Cookie> header | ||||||||||||||||||||||||||||||||||||
| 176 | #pod in an HTTP request. E.g.: | ||||||||||||||||||||||||||||||||||||
| 177 | #pod | ||||||||||||||||||||||||||||||||||||
| 178 | #pod SID=31d4d96e407aad42; lang=en-US | ||||||||||||||||||||||||||||||||||||
| 179 | #pod | ||||||||||||||||||||||||||||||||||||
| 180 | #pod It follows the same exclusion rules as C<cookies_for>. | ||||||||||||||||||||||||||||||||||||
| 181 | #pod | ||||||||||||||||||||||||||||||||||||
| 182 | #pod If the request is invalid or no cookies apply, it will return an empty string. | ||||||||||||||||||||||||||||||||||||
| 183 | #pod | ||||||||||||||||||||||||||||||||||||
| 184 | #pod =cut | ||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||
| 186 | 48 | ▶ | sub cookie_header { | ||||||||||||||||||||||||||||||||||
|
Subroutine
cookie_header: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 187 | 48 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||
| 188 | 48 | return join( "; ", map { "$_->{name}=$_->{value}" } $self->cookies_for($req) ); | |||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||
| 191 | #pod =method dump_cookies | ||||||||||||||||||||||||||||||||||||
| 192 | #pod | ||||||||||||||||||||||||||||||||||||
| 193 | #pod my @list = $jar->dump_cookies; | ||||||||||||||||||||||||||||||||||||
| 194 | #pod my @list = $jar->dump_cookies( { persistent => 1 } ); | ||||||||||||||||||||||||||||||||||||
| 195 | #pod | ||||||||||||||||||||||||||||||||||||
| 196 | #pod Returns a list of raw cookies in string form. The strings resemble what | ||||||||||||||||||||||||||||||||||||
| 197 | #pod would be received from C<Set-Cookie> headers, but with additional internal | ||||||||||||||||||||||||||||||||||||
| 198 | #pod fields. The list is only intended for use with C<load_cookies> to allow | ||||||||||||||||||||||||||||||||||||
| 199 | #pod cookie jar persistence. | ||||||||||||||||||||||||||||||||||||
| 200 | #pod | ||||||||||||||||||||||||||||||||||||
| 201 | #pod If a hash reference with a true C<persistent> key is given as an argument, | ||||||||||||||||||||||||||||||||||||
| 202 | #pod cookies without an C<Expires> time (i.e. "session cookies") will be omitted. | ||||||||||||||||||||||||||||||||||||
| 203 | #pod | ||||||||||||||||||||||||||||||||||||
| 204 | #pod Here is a trivial example of saving a cookie jar file with L<Path::Tiny>: | ||||||||||||||||||||||||||||||||||||
| 205 | #pod | ||||||||||||||||||||||||||||||||||||
| 206 | #pod path("jar.txt")->spew( join "\n", $jar->dump_cookies ); | ||||||||||||||||||||||||||||||||||||
| 207 | #pod | ||||||||||||||||||||||||||||||||||||
| 208 | #pod =cut | ||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||
| 210 | 7 | ▶ | sub dump_cookies { | ||||||||||||||||||||||||||||||||||
|
Subroutine
dump_cookies: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 211 | 7 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||||||||||
| 212 | 7 | my @list; | |||||||||||||||||||||||||||||||||||
| 213 | 7 | for my $c ( $self->_all_cookies ) { | |||||||||||||||||||||||||||||||||||
| 214 | 8 | my @parts = "$c->{name}=$c->{value}"; | |||||||||||||||||||||||||||||||||||
| 215 | 8 | ▶ | if ( defined $c->{expires} ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 216 | 4 | push @parts, 'Expires=' . HTTP::Date::time2str( $c->{expires} ); | |||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||
| 218 | else { | ||||||||||||||||||||||||||||||||||||
| 219 | 4 | ▶ | next if $args->{persistent}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||
| 221 | 7 | for my $attr (qw/Domain Path Creation_Time Last_Access_Time/) { | |||||||||||||||||||||||||||||||||||
| 222 | 28 | ▶ | push @parts, "$attr=$c->{lc $attr}" if defined $c->{ lc $attr }; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||
| 224 | 7 | for my $attr (qw/Secure HttpOnly HostOnly/) { | |||||||||||||||||||||||||||||||||||
| 225 | 21 | ▶ | push @parts, $attr if $c->{ lc $attr }; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||
| 227 | 7 | push @list, join( "; ", @parts ); | |||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||
| 229 | 7 | return @list; | |||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||
| 232 | #pod =method load_cookies | ||||||||||||||||||||||||||||||||||||
| 233 | #pod | ||||||||||||||||||||||||||||||||||||
| 234 | #pod $jar->load_cookies( @cookies ); | ||||||||||||||||||||||||||||||||||||
| 235 | #pod | ||||||||||||||||||||||||||||||||||||
| 236 | #pod Given a list of cookie strings from C<dump_cookies>, it adds them to | ||||||||||||||||||||||||||||||||||||
| 237 | #pod the cookie jar. Cookies added in this way will supersede any existing | ||||||||||||||||||||||||||||||||||||
| 238 | #pod cookies with similar domain, path and name. | ||||||||||||||||||||||||||||||||||||
| 239 | #pod | ||||||||||||||||||||||||||||||||||||
| 240 | #pod It returns the jar object for convenience when loading a new object: | ||||||||||||||||||||||||||||||||||||
| 241 | #pod | ||||||||||||||||||||||||||||||||||||
| 242 | #pod my $jar = HTTP::CookieJar->new->load_cookies( @cookies ); | ||||||||||||||||||||||||||||||||||||
| 243 | #pod | ||||||||||||||||||||||||||||||||||||
| 244 | #pod Here is a trivial example of loading a cookie jar file with L<Path::Tiny>: | ||||||||||||||||||||||||||||||||||||
| 245 | #pod | ||||||||||||||||||||||||||||||||||||
| 246 | #pod my $jar = HTTP::CookieJar->new->load_cookies( | ||||||||||||||||||||||||||||||||||||
| 247 | #pod path("jar.txt")->lines | ||||||||||||||||||||||||||||||||||||
| 248 | #pod ); | ||||||||||||||||||||||||||||||||||||
| 249 | #pod | ||||||||||||||||||||||||||||||||||||
| 250 | #pod =cut | ||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||
| 252 | 4 | ▶ | sub load_cookies { | ||||||||||||||||||||||||||||||||||
|
Subroutine
load_cookies: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 253 | 4 | my ( $self, @cookies ) = @_; | |||||||||||||||||||||||||||||||||||
| 254 | 4 | for my $cookie (@cookies) { | |||||||||||||||||||||||||||||||||||
| 255 | 5 | my $p = _parse_cookie( $cookie, 1 ); | |||||||||||||||||||||||||||||||||||
| 256 | 5 | ▶ | next unless exists $p->{domain} && exists $p->{path}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $p->{"domain"} and exists $p->{"path"}
MC/DC50%1/2
exists $p->{"domain"} and exists $p->{"path"}
exists $p->{"domain"}
exists $p->{"path"}
Truth table66%2/3
A and B
A= exists $p->{"domain"}B= exists $p->{"path"}
| |||||||||||||||||||||||||||||||||||||
| 257 | 4 | $p->{$_} = time for grep { !defined $p->{$_} } qw/creation_time last_access_time/; | |||||||||||||||||||||||||||||||||||
| 258 | 4 | $self->{store}{ $p->{domain} }{ $p->{path} }{ $p->{name} } = $p; | |||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||
| 260 | 4 | return $self; | |||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||
| 263 | #--------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||
| 264 | # private methods | ||||||||||||||||||||||||||||||||||||
| 265 | #--------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||
| 267 | # return flattened list of all cookies | ||||||||||||||||||||||||||||||||||||
| 268 | 70 | ▶ | sub _all_cookies { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_all_cookies: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 269 | 70 | return map { values %$_ } map { values %$_ } values %{ $_[0]->{store} }; | |||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||
| 272 | #--------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||
| 273 | # Helper subroutines | ||||||||||||||||||||||||||||||||||||
| 274 | #--------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||
| 276 | 8 | my $pub_re = qr/(?:domain|path|expires|max-age|httponly|secure)/; | |||||||||||||||||||||||||||||||||||
| 277 | 8 | my $pvt_re = qr/(?:$pub_re|creation_time|last_access_time|hostonly)/; | |||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||
| 279 | 98 | ▶ | sub _parse_cookie { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_cookie: called CC=17 SCAR=28.4
| |||||||||||||||||||||||||||||||||||||
| 280 | 98 | my ( $cookie, $private ) = @_; | |||||||||||||||||||||||||||||||||||
| 281 | 98 | ▶ | $cookie = '' unless defined $cookie; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 282 | 98 | my ( $kvp, @attrs ) = split /;/, $cookie; | |||||||||||||||||||||||||||||||||||
| 283 | 98 | ▶ | $kvp = '' unless defined $kvp; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 284 | my ( $name, $value ) = | ||||||||||||||||||||||||||||||||||||
| 285 | 98 | map { s/^\s*//; s/\s*$//; $_ } split( /=/, $kvp, 2 ); ## no critic | |||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||
| 287 | 98 | ▶ | return unless defined $name and length $name; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $name and length $name
MC/DC100%2/2
defined $name and length $name
defined $name
length $name
Truth table100%3/3
A and B
A= defined $nameB= length $name
| |||||||||||||||||||||||||||||||||||||
| 288 | 94 | ▶ | $value = '' unless defined $value; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 289 | 94 | my $parse = { name => $name, value => $value }; | |||||||||||||||||||||||||||||||||||
| 290 | 94 | for my $s (@attrs) { | |||||||||||||||||||||||||||||||||||
| 291 | 151 | ▶ | next unless defined $s && $s =~ /\S/; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $s and $s =~ /\S/
MC/DC50%1/2
defined $s and $s =~ /\S/
defined $s
$s =~ /\S/
Truth table66%2/3
A and B
A= defined $sB= $s =~ /\S/
| |||||||||||||||||||||||||||||||||||||
| 292 | 147 | my ( $k, $v ) = map { s/^\s*//; s/\s*$//; $_ } split( /=/, $s, 2 ); ## no critic | |||||||||||||||||||||||||||||||||||
| 293 | 147 | $k = lc $k; | |||||||||||||||||||||||||||||||||||
| 294 | 147 | ▶ | next unless $private ? ( $k =~ m/^$pvt_re$/ ) : ( $k =~ m/^$pub_re$/ ); | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 295 | 143 | ▶ | $v = 1 if $k =~ m/^(?:httponly|secure|hostonly)$/; # boolean flag if present | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 296 | 143 | ▶ | $v = HTTP::Date::str2time($v) || 0 if $k eq 'expires'; # convert to epoch | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
&HTTP::Date::str2time($v) || 0
MC/DC100%1/1
&HTTP::Date::str2time($v) || 0
&HTTP::Date::str2time($v)
Truth table100%2/2
A
A= &HTTP::Date::str2time($v)
| |||||||||||||||||||||||||||||||||||||
| 297 | 143 | ▶ | next unless length $v; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 298 | 141 | ▶ | $v =~ s{^\.}{} if $k eq 'domain'; # strip leading dot | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 299 | 141 | ▶ | $v =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg if $k eq 'path'; # unescape | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 300 | 141 | $parse->{$k} = $v; | |||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||
| 302 | 94 | return $parse; | |||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||
| 305 | 131 | ▶ | sub _domain_match { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_domain_match: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||
| 306 | 131 | my ( $string, $dom_string ) = @_; | |||||||||||||||||||||||||||||||||||
| 307 | 131 | ▶ | return 1 if $dom_string eq $string; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 308 | 69 | ▶ | return unless $string =~ /[a-z]/i; # non-numeric | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 309 | 62 | ▶ | if ( $string =~ s{\Q$dom_string\E$}{} ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 310 | 29 | return substr( $string, -1, 1 ) eq '.'; # "foo." | |||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||
| 312 | 33 | return; | |||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||
| 315 | 31 | ▶ | sub _normalize_domain { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_normalize_domain: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||
| 316 | 31 | my ( $host, $parse ) = @_; | |||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||
| 318 | 31 | ▶ | if ($HAS_MPS) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 319 | 31 | my $host_pub_suff = eval { Mozilla::PublicSuffix::public_suffix($host) }; | |||||||||||||||||||||||||||||||||||
| 320 | 31 | ▶ | $host_pub_suff = '' unless defined $host_pub_suff; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 321 | 31 | ▶ | if ( _domain_match( $host_pub_suff, $parse->{domain} ) ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 322 | 4 | ▶ | if ( $parse->{domain} eq $host ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 323 | 2 | return $parse->{hostonly} = 1; | |||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||
| 325 | else { | ||||||||||||||||||||||||||||||||||||
| 326 | 2 | return; | |||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||
| 331 | 27 | ▶ | if ( $parse->{domain} !~ m{\.} && $parse->{domain} eq $host ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $parse->{"domain"} =~ /\./ and $parse->{"domain"} eq $host
MC/DC50%1/2
not $parse->{"domain"} =~ /\./ and $parse->{"domain"} eq $host
not $parse->{"domain"} =~ /\./
$parse->{"domain"} eq $host
Truth table66%2/3
not(A) and B
A= not $parse->{"domain"} =~ /\./B= $parse->{"domain"} eq $host
| |||||||||||||||||||||||||||||||||||||
| 332 | 3 | return $parse->{hostonly} = 1; | |||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||
| 335 | 24 | return _domain_match( $host, $parse->{domain} ); | |||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||
| 338 | 34 | ▶ | sub _default_path { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_default_path: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||||||||||
| 339 | 34 | my ($path) = @_; | |||||||||||||||||||||||||||||||||||
| 340 | 34 | ▶ | return "/" if !length $path || substr( $path, 0, 1 ) ne "/"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not length $path or substr($path, 0, 1) ne "/"
MC/DC0%0/2
not length $path or substr($path, 0, 1) ne "/"
not length $path
substr($path, 0, 1) ne "/"
Truth table33%1/3
not(A) or B
A= not length $pathB= substr($path, 0, 1) ne "/"
| |||||||||||||||||||||||||||||||||||||
| 341 | 34 | my ($default) = $path =~ m{^(.*)/}; # greedy to last / | |||||||||||||||||||||||||||||||||||
| 342 | 34 | ▶ | return length($default) ? $default : "/"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||
| 345 | 66 | ▶ | sub _path_match { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_path_match: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||
| 346 | 66 | my ( $req_path, $cookie_path ) = @_; | |||||||||||||||||||||||||||||||||||
| 347 | 66 | ▶ | return 1 if $req_path eq $cookie_path; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 348 | 48 | ▶ | if ( $req_path =~ m{^\Q$cookie_path\E(.*)} ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 349 | 43 | my $rest = $1; | |||||||||||||||||||||||||||||||||||
| 350 | 43 | ▶ | return 1 if substr( $cookie_path, -1, 1 ) eq '/'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 351 | 25 | ▶ | return 1 if substr( $rest, 0, 1 ) eq '/'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||
| 353 | 5 | return; | |||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||
| 356 | 133 | ▶ | sub _split_url { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_split_url: called CC=10 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||
| 357 | 133 | my $url = shift; | |||||||||||||||||||||||||||||||||||
| 358 | 133 | ▶ | die(qq/No URL provided\n/) unless defined $url and length $url; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $url and length $url
MC/DC0%0/2
defined $url and length $url
defined $url
length $url
Truth table33%1/3
A and B
A= defined $urlB= length $url
| |||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||
| 360 | # URI regex adapted from the URI module | ||||||||||||||||||||||||||||||||||||
| 361 | # XXX path_query here really chops at ? or # to get just the path and not the query | ||||||||||||||||||||||||||||||||||||
| 362 | 133 | ▶ | my ( $scheme, $authority, $path_query ) = $url =~ m<\A([^:/?#]+)://([^/?#]*)([^#?]*)> | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 363 | or die(qq/Cannot parse URL: '$url'\n/); | ||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||
| 365 | 133 | $scheme = lc $scheme; | |||||||||||||||||||||||||||||||||||
| 366 | 133 | ▶ | $path_query = "/$path_query" unless $path_query =~ m<\A/>; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 367 | 133 | $path_query =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; | |||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||
| 369 | 133 | ▶ | my $host = ( length($authority) ) ? lc $authority : 'localhost'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 370 | 133 | $host =~ s/\A[^@]*@//; # userinfo | |||||||||||||||||||||||||||||||||||
| 371 | 133 | my $port = do { | |||||||||||||||||||||||||||||||||||
| 372 | 133 | ▶ | $host =~ s/:([0-9]*)\z// && length $1 | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$host =~ s/:([0-9]*)\z// and length $1
MC/DC50%1/2
$host =~ s/:([0-9]*)\z// and length $1
$host =~ s/:([0-9]*)\z//
length $1
Truth table66%2/3
A and B
A= $host =~ s/:([0-9]*)\z//B= length $1
| |||||||||||||||||||||||||||||||||||||
| 373 | ? $1 | ||||||||||||||||||||||||||||||||||||
| 374 | : ( $scheme eq 'http' ? 80 : $scheme eq 'https' ? 443 : undef ); | ||||||||||||||||||||||||||||||||||||
| 375 | }; | ||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||
| 377 | 133 | return ( $scheme, $host, $port, $path_query ); | |||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||
| 380 | 8 | 1; | |||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||
| 383 | # vim: ts=4 sts=4 sw=4 et: | ||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||
| 385 | __END__ | ||||||||||||||||||||||||||||||||||||