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

Last change on this file since 32787 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.3 KB
Line 
1package Mojo;
2use Mojo::Base -strict;
3
4# "Professor: These old Doomsday devices are dangerously unstable. I'll rest
5# easier not knowing where they are."
6use Mojo::Log;
7use Mojo::Transaction::HTTP;
8use Mojo::Util 'deprecated';
9
10# DEPRECATED!
11sub build_tx {
12 deprecated 'Mojo::build_tx is DEPRECATED in favor of Mojolicious::build_tx';
13 Mojo::Transaction::HTTP->new;
14}
15
16# DEPRECATED!
17sub config {
18 deprecated 'Mojo::config is DEPRECATED in favor of Mojolicious::config';
19 Mojo::Util::_stash(config => @_);
20}
21
22# DEPRECATED!
23sub log {
24 deprecated 'Mojo::log is DEPRECATED in favor of Mojolicious::log';
25 my $self = shift;
26 return $self->{log} unless @_;
27 $self->{log} = Mojo::Log->new // shift;
28 return $self;
29}
30
31# DEPRECATED!
32sub handler {
33 deprecated 'Mojo::handler is DEPRECATED in favor of Mojolicious::handler';
34}
35
361;
37
38=encoding utf8
39
40=head1 NAME
41
42Mojo - Web development toolkit
43
44=head1 SYNOPSIS
45
46 # HTTP/WebSocket user agent
47 use Mojo::UserAgent;
48 my $ua = Mojo::UserAgent->new;
49 say $ua->get('www.mojolicious.org')->result->headers->server;
50
51 # HTML/XML DOM parser with CSS selectors
52 use Mojo::DOM;
53 my $dom = Mojo::DOM->new('<div><b>Hello Mojo!</b></div>');
54 say $dom->at('div > b')->text;
55
56 # Perl-ish templates
57 use Mojo::Template;
58 my $mt = Mojo::Template->new(vars => 1);
59 say $mt->render('Hello <%= $what %>!', {what => 'Mojo'});
60
61 # HTTP/WebSocket server
62 use Mojo::Server::Daemon;
63 my $daemon = Mojo::Server::Daemon->new(listen => ['http://*:8080']);
64 $daemon->unsubscribe('request')->on(request => sub {
65 my ($daemon, $tx) = @_;
66 $tx->res->code(200);
67 $tx->res->body('Hello Mojo!');
68 $tx->resume;
69 });
70 $daemon->run;
71
72 # Event loop
73 use Mojo::IOLoop;
74 for my $seconds (1 .. 5) {
75 Mojo::IOLoop->timer($seconds => sub { say $seconds });
76 }
77 Mojo::IOLoop->start;
78
79=head1 DESCRIPTION
80
81A powerful web development toolkit, with all the basic tools and helpers needed
82to write simple web applications and higher level web frameworks, such as
83L<Mojolicious>. Some of the most commonly used tools are L<Mojo::UserAgent>,
84L<Mojo::DOM>, L<Mojo::JSON>, L<Mojo::Server::Daemon>, L<Mojo::Server::Prefork>,
85L<Mojo::IOLoop> and L<Mojo::Template>.
86
87See L<Mojolicious::Guides> for more!
88
89=head1 SEE ALSO
90
91L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
92
93=cut
Note: See TracBrowser for help on using the repository browser.