| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::Toodledo::InfoCache; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2714
|
use Moose; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
9
|
|
|
4
|
1
|
|
|
1
|
|
6670
|
use MooseX::Method::Signatures; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
13
|
|
|
5
|
1
|
|
|
1
|
|
173
|
use YAML qw(LoadFile DumpFile); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
57
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use App::Toodledo::Util qw(debug); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
7
|
1
|
|
|
1
|
|
1342
|
use Log::Log4perl; |
|
|
1
|
|
|
|
|
54590
|
|
|
|
1
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
|
|
with 'MooseX::Log::Log4perl'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has filename => ( is => 'rw', isa => 'Str', ); |
|
11
|
|
|
|
|
|
|
has password_ref => ( is => 'rw', isa => 'HashRef[Str]', |
|
12
|
|
|
|
|
|
|
default => sub { {} } ); |
|
13
|
|
|
|
|
|
|
has app_token_ref => ( is => 'rw', isa => 'HashRef[Str]', |
|
14
|
|
|
|
|
|
|
default => sub { {} } ); |
|
15
|
|
|
|
|
|
|
has default_user_id => ( is => 'rw', isa => 'Str' ); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
71534
|
method new_from_file ( $class: Str $file! ) { |
|
19
|
|
|
|
|
|
|
if ( -r $file && -f $file) |
|
20
|
|
|
|
|
|
|
{ |
|
21
|
|
|
|
|
|
|
my $ref = LoadFile( $file ); |
|
22
|
|
|
|
|
|
|
my ($password_ref, $app_token_ref, $default_user_id) |
|
23
|
|
|
|
|
|
|
= @{$ref}{qw(passwords app_tokens default_user_id)}; |
|
24
|
|
|
|
|
|
|
my $log = Log::Log4perl->get_logger(); |
|
25
|
|
|
|
|
|
|
$log->debug("Loaded info cache from $file"); |
|
26
|
|
|
|
|
|
|
return $class->new( filename => $file, |
|
27
|
|
|
|
|
|
|
password_ref => $password_ref, |
|
28
|
|
|
|
|
|
|
app_token_ref => $app_token_ref, |
|
29
|
|
|
|
|
|
|
default_user_id => $default_user_id ); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
else |
|
32
|
|
|
|
|
|
|
{ |
|
33
|
|
|
|
|
|
|
return $class->new( filename => $file ); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
55660
|
method save_to_file ( Str $filename! ) { |
|
39
|
|
|
|
|
|
|
my %params = ( passwords => $self->password_ref, |
|
40
|
|
|
|
|
|
|
app_tokens => $self->app_token_ref, |
|
41
|
|
|
|
|
|
|
default_user_id => $self->default_user_id ); |
|
42
|
|
|
|
|
|
|
DumpFile( $filename, \%params ); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
1
|
|
|
1
|
|
23788
|
method save () { |
|
47
|
|
|
|
|
|
|
$self->log->debug("test"); |
|
48
|
|
|
|
|
|
|
$self->save_to_file( $self->filename ); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Store information for making calls easier. Used for storing |
|
63
|
|
|
|
|
|
|
username => password mapping and app_id => app_token mappings. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHOR |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Peter Scott C<cpan at psdt.com> |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |