| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # ================================================================ | 
| 2 |  |  |  |  |  |  | package App::iTan::Command::Info; | 
| 3 |  |  |  |  |  |  | # ================================================================ | 
| 4 | 1 |  |  | 1 |  | 1064 | use utf8; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 5 | 1 |  |  | 1 |  | 33 | use Moose; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 6 | 1 |  |  | 1 |  | 5404 | use 5.0100; | 
|  | 1 |  |  |  |  | 4 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 1 |  |  | 1 |  | 7 | use MooseX::App::Command; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 10 |  | 
| 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 |  |  | 1 |  | 7438 | use Text::Table; | 
|  | 1 |  |  |  |  | 7049 |  | 
|  | 1 |  |  |  |  | 206 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | sub execute { | 
| 21 | 0 |  |  | 0 | 0 |  | my ( $self, $opts, $args ) = @_; | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 0 | 0 |  |  |  |  | my $sth | 
| 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 | 0 |  |  |  |  | $sth->execute( $self->index ) | 
| 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() ) { | 
| 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 |