line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2007 Jon Connell. |
2
|
|
|
|
|
|
|
# All Rights Reserved. |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
5
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Finance::Bank::Cahoot::CredentialsProvider; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
28274
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
246
|
|
10
|
4
|
|
|
4
|
|
26
|
use warnings 'all'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
198
|
|
11
|
4
|
|
|
4
|
|
21
|
use vars qw($VERSION); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
240
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$VERSION = '1.07'; |
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
111
|
use Carp qw(croak); |
|
4
|
|
|
|
|
568
|
|
|
4
|
|
|
|
|
285
|
|
16
|
4
|
|
|
4
|
|
4234
|
use English '-no_match_vars'; |
|
4
|
|
|
|
|
12668
|
|
|
4
|
|
|
|
|
22
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new |
19
|
|
|
|
|
|
|
{ |
20
|
38
|
|
|
38
|
1
|
43813
|
my ($class, %args) = @_; |
21
|
|
|
|
|
|
|
|
22
|
38
|
100
|
|
|
|
110
|
croak 'Calling abstract base class constructor for '.__PACKAGE__.' is forbidden' |
23
|
|
|
|
|
|
|
if $class eq __PACKAGE__; |
24
|
|
|
|
|
|
|
|
25
|
37
|
100
|
|
|
|
123
|
croak 'Must provide a list of credentials' |
26
|
|
|
|
|
|
|
if not exists $args{credentials}; |
27
|
|
|
|
|
|
|
|
28
|
33
|
100
|
|
|
|
129
|
croak 'credentials is not an array ref' |
29
|
|
|
|
|
|
|
if ref $args{credentials} ne 'ARRAY'; |
30
|
|
|
|
|
|
|
|
31
|
29
|
100
|
|
|
|
65
|
if (exists $args{options}) { |
32
|
28
|
100
|
|
|
|
113
|
croak 'options must be a hash ref' |
33
|
|
|
|
|
|
|
if ref $args{options} ne 'HASH'; |
34
|
24
|
|
|
|
|
28
|
my @o = keys %{$args{options}}; |
|
24
|
|
|
|
|
82
|
|
35
|
24
|
100
|
|
|
|
108
|
croak 'Empty list of options' |
36
|
|
|
|
|
|
|
if $#o < 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
21
|
|
|
|
|
48
|
my $self = { }; |
40
|
21
|
|
|
|
|
51
|
bless $self, $class; |
41
|
21
|
|
|
|
|
151
|
$self->{_credentials} = $args{credentials}; |
42
|
21
|
|
|
|
|
28
|
foreach my $credential (@{$args{credentials}}) { |
|
21
|
|
|
|
|
86
|
|
43
|
4
|
|
|
4
|
|
2478
|
no strict 'refs'; ## no critic |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
676
|
|
44
|
64
|
|
|
37
|
|
307
|
*{"${class}::$credential"} = sub { my ($self, $offset) = @_; |
|
37
|
|
|
|
|
3264
|
|
45
|
37
|
|
|
|
|
167
|
return $self->get($credential, $offset); |
46
|
64
|
|
|
|
|
208
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
21
|
|
|
|
|
85
|
$self->_init($args{options}); |
49
|
8
|
|
|
|
|
40
|
return $self; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub get |
53
|
|
|
|
|
|
|
{ |
54
|
1
|
|
|
1
|
1
|
24
|
my ($self) = @_; |
55
|
1
|
|
|
|
|
2
|
my $class = ref $self; |
56
|
1
|
|
|
|
|
31
|
croak 'Calling abstract base class get method for '.$class.' is forbidden'; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |