source: main/trunk/greenstone2/perllib/cpan/Mojo/Cookie.pm@ 32205

Last change on this file since 32205 was 32205, checked in by ak19, 6 years ago

First set of commits to do with implementing the new 'paged_html' output option of PDFPlugin that uses using xpdftools' new pdftohtml. So far tested only on Linux (64 bit), but things work there so I'm optimistically committing the changes since they work. 2. Committing the pre-built Linux binaries of XPDFtools for both 32 and 64 bit built by the XPDF group. 2. To use the correct bitness variant of xpdftools, setup.bash now exports the BITNESS env var, consulted by gsConvert.pl. 3. All the perl code changes to do with using xpdf tools' pdftohtml to generate paged_html and feed it in the desired form into GS(3): gsConvert.pl, PDFPlugin.pm and its parent ConvertBinaryPFile.pm have been modified to make it all work. xpdftools' pdftohtml generates a folder containing an html file and a screenshot for each page in a PDF (as well as an index.html linking to each page's html). However, we want a single html file that contains each individual 'page' html's content in a div, and need to do some further HTML style, attribute and structure modifications to massage the xpdftool output to what we want for GS. In order to parse and manipulate the HTML 'DOM' to do this, we're using the Mojo::DOM package that Dr Bainbridge found and which he's compiled up. Mojo::DOM is therefore also committed in this revision. Some further changes and some display fixes are required, but need to check with the others about that.

File size: 1.6 KB
Line 
1package Mojo::Cookie;
2use Mojo::Base -base;
3use overload bool => sub {1}, '""' => sub { shift->to_string }, fallback => 1;
4
5use Carp 'croak';
6
7has [qw(name value)];
8
9sub parse { croak 'Method "parse" not implemented by subclass' }
10sub to_string { croak 'Method "to_string" not implemented by subclass' }
11
121;
13
14=encoding utf8
15
16=head1 NAME
17
18Mojo::Cookie - HTTP cookie base class
19
20=head1 SYNOPSIS
21
22 package Mojo::Cookie::MyCookie;
23 use Mojo::Base 'Mojo::Cookie';
24
25 sub parse {...}
26 sub to_string {...}
27
28=head1 DESCRIPTION
29
30L<Mojo::Cookie> is an abstract base class for HTTP cookie containers, based on
31L<RFC 6265|http://tools.ietf.org/html/rfc6265>, like L<Mojo::Cookie::Request>
32and L<Mojo::Cookie::Response>.
33
34=head1 ATTRIBUTES
35
36L<Mojo::Cookie> implements the following attributes.
37
38=head2 name
39
40 my $name = $cookie->name;
41 $cookie = $cookie->name('foo');
42
43Cookie name.
44
45=head2 value
46
47 my $value = $cookie->value;
48 $cookie = $cookie->value('/test');
49
50Cookie value.
51
52=head1 METHODS
53
54L<Mojo::Cookie> inherits all methods from L<Mojo::Base> and implements the
55following new ones.
56
57=head2 parse
58
59 my $cookies = $cookie->parse($str);
60
61Parse cookies. Meant to be overloaded in a subclass.
62
63=head2 to_string
64
65 my $str = $cookie->to_string;
66
67Render cookie. Meant to be overloaded in a subclass.
68
69=head1 OPERATORS
70
71L<Mojo::Cookie> overloads the following operators.
72
73=head2 bool
74
75 my $bool = !!$cookie;
76
77Always true.
78
79=head2 stringify
80
81 my $str = "$cookie";
82
83Alias for L</"to_string">.
84
85=head1 SEE ALSO
86
87L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
88
89=cut
Note: See TracBrowser for help on using the repository browser.