| 1 | # ================================================================ | ||||||||||
| 2 | package App::iTan::Command::Info; | ||||||||||
| 3 | # ================================================================ | ||||||||||
| 4 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use 5.0100; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use MooseX::App::Command; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | with qw(App::iTan::Utils); | ||||||||||
| 10 | |||||||||||
| 11 | option 'index' => ( | ||||||||||
| 12 | is => 'ro', | ||||||||||
| 13 | isa => 'Int', | ||||||||||
| 14 | required => 1, | ||||||||||
| 15 | documentation => q[iTAN index number that should be fetched], | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 1 | ▶ | use Text::Table; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=4 SCAR=30.0
| |||||||||||
| 21 | 0 | my ( $self, $opts, $args ) = @_; | |||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | my $sth | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | = $self->dbh->prepare( | ||||||||||
| 25 | 'SELECT tindex,valid,itan,imported,used,memo FROM itan WHERE tindex = ?' | ||||||||||
| 26 | ) or die "ERROR: Cannot prepare: " . $self->dbh->errstr(); | ||||||||||
| 27 | 0 | ▶ | $sth->execute( $self->index ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | or die "ERROR: Cannot execute: " . $sth->errstr(); | ||||||||||
| 29 | |||||||||||
| 30 | 0 | my $tb = Text::Table->new( | |||||||||
| 31 | "Index", \"|", "Valid", \"|", "Tan", \"|", | ||||||||||
| 32 | "Imported", \"|", "Used", \"|", "Memo" | ||||||||||
| 33 | ); | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | while ( my $tan_data = $sth->fetchrow_hashref() ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | |||||||||||
| 37 | $tb->add( | ||||||||||
| 38 | $tan_data->{tindex}, | ||||||||||
| 39 | $tan_data->{valid}, | ||||||||||
| 40 | $self->decrypt_string( $tan_data->{itan} ), | ||||||||||
| 41 | $tan_data->{imported}, | ||||||||||
| 42 | $tan_data->{used}, | ||||||||||
| 43 | 0 | $tan_data->{memo} ); | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 0 | print $tb->title; | |||||||||
| 47 | 0 | print $tb->rule( '-', '+' ); | |||||||||
| 48 | 0 | print $tb->body; | |||||||||
| 49 | |||||||||||
| 50 | 0 | return; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | __PACKAGE__->meta->make_immutable; | ||||||||||
| 54 | 1; | ||||||||||
| 55 | |||||||||||
| 56 | =pod | ||||||||||
| 57 | |||||||||||
| 58 | =encoding utf8 | ||||||||||
| 59 | |||||||||||
| 60 | =head1 NAME | ||||||||||
| 61 | |||||||||||
| 62 | App::iTan::Command::Info - Info about the selected iTAN | ||||||||||
| 63 | |||||||||||
| 64 | =head1 SYNOPSIS | ||||||||||
| 65 | |||||||||||
| 66 | itan info --index INDEX | ||||||||||
| 67 | |||||||||||
| 68 | =head1 DESCRIPTION | ||||||||||
| 69 | |||||||||||
| 70 | Will print a detailed report about the selected iTAN | ||||||||||
| 71 | |||||||||||
| 72 | =head1 OPTIONS | ||||||||||
| 73 | |||||||||||
| 74 | =head2 index | ||||||||||
| 75 | |||||||||||
| 76 | iTAN index number that should be fetched | ||||||||||
| 77 | |||||||||||
| 78 | =cut | ||||||||||