source: main/trunk/greenstone2/perllib/cpan/Mojolicious/Command/version.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.7 KB
Line 
1package Mojolicious::Command::version;
2use Mojo::Base 'Mojolicious::Command';
3
4use Mojo::IOLoop::Client;
5use Mojo::IOLoop::TLS;
6use Mojolicious;
7
8has description => 'Show versions of available modules';
9has usage => sub { shift->extract_usage };
10
11sub run {
12 my $self = shift;
13
14 my $ev = eval { require Mojo::Reactor::EV; 1 } ? $EV::VERSION : 'n/a';
15 my $socks
16 = Mojo::IOLoop::Client->can_socks ? $IO::Socket::Socks::VERSION : 'n/a';
17 my $tls = Mojo::IOLoop::TLS->can_tls ? $IO::Socket::SSL::VERSION : 'n/a';
18 my $nnr = Mojo::IOLoop::Client->can_nnr ? $Net::DNS::Native::VERSION : 'n/a';
19 my $roles = Mojo::Base->ROLES ? $Role::Tiny::VERSION : 'n/a';
20
21 print <<EOF;
22CORE
23 Perl ($^V, $^O)
24 Mojolicious ($Mojolicious::VERSION, $Mojolicious::CODENAME)
25
26OPTIONAL
27 EV 4.0+ ($ev)
28 IO::Socket::Socks 0.64+ ($socks)
29 IO::Socket::SSL 2.009+ ($tls)
30 Net::DNS::Native 0.15+ ($nnr)
31 Role::Tiny 2.000001+ ($roles)
32
33EOF
34
35 # Check latest version on CPAN
36 my $latest = eval {
37 $self->app->ua->max_redirects(10)->tap(sub { $_->proxy->detect })
38 ->get('fastapi.metacpan.org/v1/release/Mojolicious')
39 ->result->json->{version};
40 } or return;
41
42 my $msg = 'This version is up to date, have fun!';
43 $msg = 'Thanks for testing a development release, you are awesome!'
44 if $latest < $Mojolicious::VERSION;
45 $msg = "You might want to update your Mojolicious to $latest!"
46 if $latest > $Mojolicious::VERSION;
47 say $msg;
48}
49
501;
51
52=encoding utf8
53
54=head1 NAME
55
56Mojolicious::Command::version - Version command
57
58=head1 SYNOPSIS
59
60 Usage: APPLICATION version [OPTIONS]
61
62 mojo version
63
64 Options:
65 -h, --help Show this summary of available options
66
67=head1 DESCRIPTION
68
69L<Mojolicious::Command::version> shows version information for available core
70and optional modules.
71
72This is a core command, that means it is always enabled and its code a good
73example for learning to build new commands, you're welcome to fork it.
74
75See L<Mojolicious::Commands/"COMMANDS"> for a list of commands that are
76available by default.
77
78=head1 ATTRIBUTES
79
80L<Mojolicious::Command::version> inherits all attributes from
81L<Mojolicious::Command> and implements the following new ones.
82
83=head2 description
84
85 my $description = $v->description;
86 $v = $v->description('Foo');
87
88Short description of this command, used for the command list.
89
90=head2 usage
91
92 my $usage = $v->usage;
93 $v = $v->usage('Foo');
94
95Usage information for this command, used for the help screen.
96
97=head1 METHODS
98
99L<Mojolicious::Command::version> inherits all methods from
100L<Mojolicious::Command> and implements the following new ones.
101
102=head2 run
103
104 $v->run(@ARGV);
105
106Run this command.
107
108=head1 SEE ALSO
109
110L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
111
112=cut
Note: See TracBrowser for help on using the repository browser.