Curie/App.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Curie/Model/ViewOptions/Grid.pm ↑ Summary Curie/Error.pm »
1 3 ▶use Renard::Incunabula::Common::Setup;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Renard::Curie::App;
3 # ABSTRACT: A document viewing application
4 $Renard::Curie::App::VERSION = '0.005';
5 3 ▶use Moo 2.001001;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 0 ▶use Intertangle::API::Gtk3::Helper;
Subroutine BEGIN: called CC=1 SCAR=2.6
8  
9 use File::Spec;
10 use File::Basename;
11 use Module::Util qw(:all);
12 use Renard::Incunabula::Common::Types qw(InstanceOf Str);
13 use Renard::Incunabula::Document::Types qw(DocumentModel);
14 use Getopt::Long::Descriptive;
15  
16 use MooX::Role::Logger ();
17  
18 use Renard::Curie::Component::MainWindow;
19 use Renard::Curie::ViewModel::ViewManager;
20  
21 has main_window => (
22 is => 'ro',
23 required => 1,
24 isa => InstanceOf['Renard::Curie::Component::MainWindow'],
25 );
26  
27 has view_manager => (
28 is => 'ro',
29 required => 1,
30 isa => InstanceOf['Renard::Curie::ViewModel::ViewManager'],
31 );
32  
33 method process_arguments() {
34 my ($opt, $usage) = describe_options(
35 "%c %o <filename>",
36 [ 'version', "print version and exit" ],
37 [ 'short-version', "print just the version number (if exists) and exit" ],
38 [ 'help', "print usage message and exit" ],
39 );
40  
41 print($usage->text), exit if $opt->help;
42  
43 if($opt->version) {
44 say("Project Renard Curie @{[ _get_version() ]}");
45 say("Distributed under the same terms as Perl 5.");
46 exit;
47 }
48  
49 if($opt->short_version) {
50 say(_get_version()), exit
51 }
52  
53 my $pdf_filename = shift @ARGV;
54  
55 if( $pdf_filename ) {
56 $self->_logger->infof("opening the file %s", $pdf_filename);
57 $self->view_manager->open_pdf_document( $pdf_filename );
58 }
59 }
60  
61 method main() {
62 $self = __PACKAGE__->new unless ref $self;
63 $self->process_arguments;
64 $self->main_window->show_all;
65 $self->run;
66 }
67  
68 method run() {
69 $self->_logger->info("starting the Gtk main event loop");
70 Gtk3::main;
71 }
72  
73 fun _get_version() :ReturnType(Str) {
74 return $Renard::Curie::App::VERSION // 'dev'
75 }
76  
77 with qw(
78 MooX::Role::Logger
79 );
80  
81 1;
82  
83 __END__
« Curie/Model/ViewOptions/Grid.pm ↑ Summary Curie/Error.pm »