| 1 | package Log::Saftpresse::App; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | # ABSTRACT: commandline interface extension for Log::Saftpresse | ||||||||||
| 6 | 1 | our $VERSION = '1.5'; # VERSION | |||||||||
| 7 | |||||||||||
| 8 | 1 | extends 'Log::Saftpresse'; | |||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use Getopt::Long; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use Log::Saftpresse::Log4perl; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | sub print_usage { | ||||||||||
| 14 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
print_usage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 15 | 0 | print " usage: $0 | |||||||||
| 16 | [--config|-c <file>] | ||||||||||
| 17 | [--log-level|-l <level>] | ||||||||||
| 18 | [--help|-h] | ||||||||||
| 19 | \n"; | ||||||||||
| 20 | 0 | exit 0; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | has 'options' => ( | ||||||||||
| 24 | is => 'rw', isa => 'HashRef', | ||||||||||
| 25 | default => sub { | ||||||||||
| 26 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 27 | 0 | my %opts; | |||||||||
| 28 | |||||||||||
| 29 | GetOptions( | ||||||||||
| 30 | "help|h" => \$opts{'help'}, | ||||||||||
| 31 | "config|c=s" => \$opts{'config'}, | ||||||||||
| 32 | 0 | ▶ | "log-level|l=i" => \$opts{'log_level'}, | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | ) or $self->print_usage; | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | if( $opts{'help'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | $self->print_usage; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | return \%opts; | |||||||||
| 40 | }, | ||||||||||
| 41 | 1 | ); | |||||||||
| 42 | |||||||||||
| 43 | sub init_with_options { | ||||||||||
| 44 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
init_with_options: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | if( $self->options->{'config'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | $self->load_config( $self->options->{'config'} ); | |||||||||
| 48 | } | ||||||||||
| 49 | 0 | $self->init; | |||||||||
| 50 | 0 | ▶ | if( defined $self->options->{'log_level'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 0 | Log::Saftpresse::Log4perl->level( $self->options->{'log_level'} ); | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 0 | return; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 1 | 1; | |||||||||
| 58 | |||||||||||
| 59 | __END__ | ||||||||||
| 60 | |||||||||||
| 61 | =pod | ||||||||||
| 62 | |||||||||||
| 63 | =encoding UTF-8 | ||||||||||
| 64 | |||||||||||
| 65 | =head1 NAME | ||||||||||
| 66 | |||||||||||
| 67 | Log::Saftpresse::App - commandline interface extension for Log::Saftpresse | ||||||||||
| 68 | |||||||||||
| 69 | =head1 VERSION | ||||||||||
| 70 | |||||||||||
| 71 | version 1.5 | ||||||||||
| 72 | |||||||||||
| 73 | =head1 AUTHOR | ||||||||||
| 74 | |||||||||||
| 75 | Markus Benning <ich@markusbenning.de> | ||||||||||
| 76 | |||||||||||
| 77 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 78 | |||||||||||
| 79 | This software is Copyright (c) 1998 by James S. Seymour, 2015 by Markus Benning. | ||||||||||
| 80 | |||||||||||
| 81 | This is free software, licensed under: | ||||||||||
| 82 | |||||||||||
| 83 | The GNU General Public License, Version 2, June 1991 | ||||||||||
| 84 | |||||||||||
| 85 | =cut | ||||||||||