| 1 | package PGP::Finger::App; | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 4 | |||||||||||||||||||||||
| 5 | 1 | our $VERSION = '1.1'; # VERSION | |||||||||||||||||||||
| 6 | # ABSTRACT: commandline interface to PGP::Finger | ||||||||||||||||||||||
| 7 | |||||||||||||||||||||||
| 8 | 1 | extends 'PGP::Finger'; | |||||||||||||||||||||
| 9 | 1 | with 'MooseX::Getopt'; | |||||||||||||||||||||
| 10 | |||||||||||||||||||||||
| 11 | 1 | ▶ | use PGP::Finger::DNS; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 12 | 1 | ▶ | use PGP::Finger::Keyserver; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 13 | 1 | ▶ | use PGP::Finger::GPG; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 14 | 1 | ▶ | use PGP::Finger::File; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 15 | |||||||||||||||||||||||
| 16 | has '+sources' => ( | ||||||||||||||||||||||
| 17 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||
| 18 | 0 | ▶ | default => sub { | ||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||
| 19 | 0 | my $self = shift; | |||||||||||||||||||||
| 20 | 0 | my @srcs; | |||||||||||||||||||||
| 21 | 0 | foreach my $q ( @{$self->_query} ) { | |||||||||||||||||||||
| 22 | 0 | my $src; | |||||||||||||||||||||
| 23 | 0 | $q = lc($q); | |||||||||||||||||||||
| 24 | 0 | ▶ | if( $q eq 'dns' ) { | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 25 | 0 | $src = PGP::Finger::DNS->new(); | |||||||||||||||||||||
| 26 | } elsif( $q eq 'keyserver' ) { | ||||||||||||||||||||||
| 27 | 0 | $src = PGP::Finger::Keyserver->new(); | |||||||||||||||||||||
| 28 | } elsif( $q eq 'gpg' ) { | ||||||||||||||||||||||
| 29 | 0 | $src = PGP::Finger::GPG->new(); | |||||||||||||||||||||
| 30 | } elsif( $q eq 'file' ) { | ||||||||||||||||||||||
| 31 | 0 | $src = PGP::Finger::File->new( | |||||||||||||||||||||
| 32 | input => $self->input, | ||||||||||||||||||||||
| 33 | format => $self->format, | ||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||
| 35 | } else { | ||||||||||||||||||||||
| 36 | 0 | die('unknown query type: '.$q); | |||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||
| 38 | 0 | push( @srcs, $src ); | |||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||
| 40 | 0 | return( \@srcs ); | |||||||||||||||||||||
| 41 | }, | ||||||||||||||||||||||
| 42 | 1 | ); | |||||||||||||||||||||
| 43 | |||||||||||||||||||||||
| 44 | 1 | has 'format' => ( is => 'ro', isa => 'Str', default => 'armored', | |||||||||||||||||||||
| 45 | traits => ['Getopt'], | ||||||||||||||||||||||
| 46 | cmd_aliases => 'f', | ||||||||||||||||||||||
| 47 | documentation => 'format of input (armored or binary)', | ||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||
| 49 | |||||||||||||||||||||||
| 50 | 1 | has 'input' => ( is => 'ro', isa => 'Str', default => '-', | |||||||||||||||||||||
| 51 | traits => ['Getopt'], | ||||||||||||||||||||||
| 52 | cmd_aliases => 'i', | ||||||||||||||||||||||
| 53 | documentation => 'path or - for stdin', | ||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||
| 55 | |||||||||||||||||||||||
| 56 | 1 | has 'query' => ( is => 'ro', isa => 'Str', default => 'dns,keyserver', | |||||||||||||||||||||
| 57 | traits => ['Getopt'], | ||||||||||||||||||||||
| 58 | cmd_aliases => 'q', | ||||||||||||||||||||||
| 59 | documentation => 'sources to query (default: dns,keyserver)', | ||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||
| 61 | |||||||||||||||||||||||
| 62 | has '_query' => ( is => 'ro', isa => 'ArrayRef[Str]', lazy => 1, | ||||||||||||||||||||||
| 63 | 0 | ▶ | default => sub { | ||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||
| 64 | 0 | my $self = shift; | |||||||||||||||||||||
| 65 | 0 | return [ split(/\s*,\s*/, $self->query) ]; | |||||||||||||||||||||
| 66 | }, | ||||||||||||||||||||||
| 67 | 1 | ); | |||||||||||||||||||||
| 68 | |||||||||||||||||||||||
| 69 | 1 | has 'output' => ( is => 'ro', isa => 'Str', default => 'armored', | |||||||||||||||||||||
| 70 | traits => ['Getopt'], | ||||||||||||||||||||||
| 71 | cmd_aliases => 'o', | ||||||||||||||||||||||
| 72 | documentation => 'output format: armored,rfc or generic (default: armored)', | ||||||||||||||||||||||
| 73 | ); | ||||||||||||||||||||||
| 74 | |||||||||||||||||||||||
| 75 | 0 | ▶ | sub _usage_format { | ||||||||||||||||||||
|
Subroutine
_usage_format: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||
| 76 | 0 | return "usage: %c %o <uid> <more uids ...>"; | |||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||
| 78 | |||||||||||||||||||||||
| 79 | 0 | ▶ | sub run { | ||||||||||||||||||||
|
Subroutine
run: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||
| 80 | 0 | my $self = shift; | |||||||||||||||||||||
| 81 | 0 | my @uids = @{$self->extra_argv}; | |||||||||||||||||||||
| 82 | |||||||||||||||||||||||
| 83 | 0 | ▶ | if( ! @uids ) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 84 | 0 | print $self->usage; | |||||||||||||||||||||
| 85 | 0 | exit 1; | |||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||
| 87 | |||||||||||||||||||||||
| 88 | 0 | foreach my $uid ( @uids ) { | |||||||||||||||||||||
| 89 | 0 | my $resultset = $self->fetch( $uid ); | |||||||||||||||||||||
| 90 | 0 | print $resultset->as_string( $self->output ); | |||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||
| 92 | |||||||||||||||||||||||
| 93 | 0 | return; | |||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||
| 95 | |||||||||||||||||||||||
| 96 | 1 | 1; | |||||||||||||||||||||
| 97 | |||||||||||||||||||||||
| 98 | __END__ | ||||||||||||||||||||||