source: main/trunk/greenstone2/perllib/cpan/Mojolicious/Command/cgi.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: 2.0 KB
Line 
1package Mojolicious::Command::cgi;
2use Mojo::Base 'Mojolicious::Command';
3
4use Mojo::Server::CGI;
5use Mojo::Util 'getopt';
6
7has description => 'Start application with CGI';
8has usage => sub { shift->extract_usage };
9
10sub run {
11 my ($self, @args) = @_;
12 getopt \@args, nph => \(my $nph = 0);
13 Mojo::Server::CGI->new(app => $self->app, nph => $nph)->run;
14}
15
161;
17
18=encoding utf8
19
20=head1 NAME
21
22Mojolicious::Command::cgi - CGI command
23
24=head1 SYNOPSIS
25
26 Usage: APPLICATION cgi [OPTIONS]
27
28 ./myapp.pl cgi
29
30 Options:
31 -h, --help Show this summary of available options
32 --home <path> Path to home directory of your application, defaults to
33 the value of MOJO_HOME or auto-detection
34 -m, --mode <name> Operating mode for your application, defaults to the
35 value of MOJO_MODE/PLACK_ENV or "development"
36 --nph Enable non-parsed-header mode
37
38=head1 DESCRIPTION
39
40L<Mojolicious::Command::cgi> starts applications with the L<Mojo::Server::CGI>
41backend.
42
43This is a core command, that means it is always enabled and its code a good
44example for learning to build new commands, you're welcome to fork it.
45
46See L<Mojolicious::Commands/"COMMANDS"> for a list of commands that are
47available by default.
48
49=head1 ATTRIBUTES
50
51L<Mojolicious::Command::cgi> inherits all attributes from
52L<Mojolicious::Command> and implements the following new ones.
53
54=head2 description
55
56 my $description = $cgi->description;
57 $cgi = $cgi->description('Foo');
58
59Short description of this command, used for the command list.
60
61=head2 usage
62
63 my $usage = $cgi->usage;
64 $cgi = $cgi->usage('Foo');
65
66Usage information for this command, used for the help screen.
67
68=head1 METHODS
69
70L<Mojolicious::Command::cgi> inherits all methods from L<Mojolicious::Command>
71and implements the following new ones.
72
73=head2 run
74
75 $cgi->run(@ARGV);
76
77Run this command.
78
79=head1 SEE ALSO
80
81L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
82
83=cut
Note: See TracBrowser for help on using the repository browser.