source: main/trunk/greenstone2/perllib/cpan/Mojo/Upload.pm

Last change on this file 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::Upload;
2use Mojo::Base -base;
3
4has [qw(asset filename headers name)];
5
6sub move_to { $_[0]->asset->move_to($_[1]) and return $_[0] }
7
8sub size { shift->asset->size }
9sub slurp { shift->asset->slurp }
10
111;
12
13=encoding utf8
14
15=head1 NAME
16
17Mojo::Upload - Upload
18
19=head1 SYNOPSIS
20
21 use Mojo::Upload;
22
23 my $upload = Mojo::Upload->new;
24 say $upload->filename;
25 $upload->move_to('/home/sri/foo.txt');
26
27=head1 DESCRIPTION
28
29L<Mojo::Upload> is a container for uploaded files.
30
31=head1 ATTRIBUTES
32
33L<Mojo::Upload> implements the following attributes.
34
35=head2 asset
36
37 my $asset = $upload->asset;
38 $upload = $upload->asset(Mojo::Asset::File->new);
39
40Asset containing the uploaded data, usually a L<Mojo::Asset::File> or
41L<Mojo::Asset::Memory> object.
42
43=head2 filename
44
45 my $filename = $upload->filename;
46 $upload = $upload->filename('foo.txt');
47
48Name of the uploaded file.
49
50=head2 headers
51
52 my $headers = $upload->headers;
53 $upload = $upload->headers(Mojo::Headers->new);
54
55Headers for upload, usually a L<Mojo::Headers> object.
56
57=head2 name
58
59 my $name = $upload->name;
60 $upload = $upload->name('foo');
61
62Name of the upload.
63
64=head1 METHODS
65
66L<Mojo::Upload> inherits all methods from L<Mojo::Base> and implements the
67following new ones.
68
69=head2 move_to
70
71 $upload = $upload->move_to('/home/sri/foo.txt');
72
73Move uploaded data into a specific file.
74
75=head2 size
76
77 my $size = $upload->size;
78
79Size of uploaded data in bytes.
80
81=head2 slurp
82
83 my $bytes = $upload->slurp;
84
85Read all uploaded data at once.
86
87=head1 SEE ALSO
88
89L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
90
91=cut
Note: See TracBrowser for help on using the repository browser.