source: main/trunk/greenstone2/perllib/cpan/Mojo/Server/Morbo/Backend.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.8 KB
Line 
1package Mojo::Server::Morbo::Backend;
2use Mojo::Base -base;
3
4use Carp 'croak';
5
6has watch => sub { [qw(lib templates)] };
7has watch_timeout => sub { $ENV{MOJO_MORBO_TIMEOUT} || 1 };
8
9sub modified_files {
10 croak 'Method "modified_files" not implemented by subclass';
11}
12
131;
14
15=encoding utf8
16
17=head1 NAME
18
19Mojo::Server::Morbo::Backend - Morbo backend base class
20
21=head1 SYNOPSIS
22
23 package Mojo::Server::Morbo::Backend::Inotify:
24 use Mojo::Base 'Mojo::Server::Morbo::Backend';
25
26 sub modified_files {...}
27
28=head1 DESCRIPTION
29
30L<Mojo::Server::Morbo::Backend> is an abstract base class for Morbo backends,
31like L<Mojo::Server::Morbo::Backend::Poll>.
32
33=head1 ATTRIBUTES
34
35L<Mojo::Server::Morbo::Backend> implements the following attributes.
36
37=head2 watch
38
39 my $watch = $backend->watch;
40 $backend = $backend->watch(['/home/sri/my_app']);
41
42Files and directories to watch for changes, defaults to the application script
43as well as the C<lib> and C<templates> directories in the current working
44directory.
45
46=head2 watch_timeout
47
48 my $timeout = $backend->watch_timeout;
49 $backend = $backend->watch_timeout(10);
50
51Maximum amount of time in seconds a backend may block when waiting for files to
52change, defaults to the value of the C<MOJO_MORBO_TIMEOUT> environment variable
53or C<1>.
54
55=head1 METHODS
56
57L<Mojo::Server::Morbo::Backend> inherits all methods from L<Mojo::Base> and
58implements the following new ones.
59
60=head2 modified_files
61
62 my $files = $backend->modified_files;
63
64Check if files from L</"watch"> have been modified since the last check and
65return an array reference with the results. Meant to be overloaded in a
66subclass.
67
68 # All files that have been modified
69 say for @{$backend->modified_files};
70
71=head1 SEE ALSO
72
73L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
74
75=cut
Note: See TracBrowser for help on using the repository browser.