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