File Coverage

blib/lib/File/KeePass/KDBX/Tie/Entry.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 0 2 0.0
total 32 34 94.1


line stmt bran cond sub pod time code
1             package File::KeePass::KDBX::Tie::Entry;
2             # ABSTRACT: Database entry
3              
4 2     2   1068 use warnings;
  2         4  
  2         68  
5 2     2   11 use strict;
  2         3  
  2         48  
6              
7 2     2   10 use Crypt::Digest;
  2         3  
  2         69  
8 2     2   10 use Time::Piece;
  2         4  
  2         9  
9 2     2   119 use boolean;
  2         4  
  2         8  
10 2     2   115 use namespace::clean;
  2         2  
  2         10  
11              
12 2     2   402 use parent 'File::KeePass::KDBX::Tie::Hash';
  2         4  
  2         9  
13              
14             our $VERSION = '0.902'; # VERSION
15              
16             my %GET = (
17             accessed => sub { File::KeePass::KDBX::_decode_datetime($_[0]->last_access_time) },
18             usage_count => sub { $_[0]->usage_count },
19             expires_enabled => sub { $_[0]->expires ? 1 : 0 },
20             created => sub { File::KeePass::KDBX::_decode_datetime($_[0]->creation_time) },
21             expires => sub { File::KeePass::KDBX::_decode_datetime($_[0]->expiry_time) },
22             modified => sub { File::KeePass::KDBX::_decode_datetime($_[0]->last_modification_time) },
23             location_changed => sub { File::KeePass::KDBX::_decode_datetime($_[0]->location_changed) },
24             auto_type_munge => sub { $_[0]->auto_type->{data_transfer_obfuscation} ? 1 : 0 },
25             auto_type_enabled => sub { $_[0]->auto_type->{enabled} ? 1 : 0 },
26             auto_type => sub { $_[-1]->_tie([], 'AssociationList', $_[0]) },
27             comment => sub { $_[0]->notes },
28             username => sub { $_[0]->username },
29             password => sub { $_[0]->password },
30             url => sub { $_[0]->url },
31             title => sub { $_[0]->title },
32             protected => sub { $_[-1]->_tie({}, 'Protected', $_[0]) },
33             override_url => sub { $_[0]->override_url },
34             tags => sub { $_[0]->tags },
35             icon => sub { $_[0]->icon_id + 0 },
36             id => sub { $_[0]->uuid },
37             foreground_color => sub { $_[0]->foreground_color },
38             background_color => sub { $_[0]->background_color },
39             history => sub { $_[-1]->_tie([], 'EntryList', $_[0], 'history') },
40             strings => sub { $_[-1]->_tie({}, 'Strings', $_[0]) },
41             binary => sub { $_[-1]->_tie({}, 'Binary', $_[0]) },
42             );
43             my %SET = (
44             accessed => sub { $_[0]->last_access_time(File::KeePass::KDBX::_encode_datetime($_)) },
45             usage_count => sub { $_[0]->usage_count($_) },
46             expires_enabled => sub { $_[0]->expires($_) },
47             created => sub { $_[0]->creation_time(File::KeePass::KDBX::_encode_datetime($_)) },
48             expires => sub { $_[0]->expiry_time(File::KeePass::KDBX::_encode_datetime($_)) },
49             modified => sub { $_[0]->last_modification_time(File::KeePass::KDBX::_encode_datetime($_)) },
50             location_changed => sub { $_[0]->location_changed(File::KeePass::KDBX::_encode_datetime($_)) },
51             override_url => sub { $_[0]->override_url($_) },
52             auto_type_munge => sub { $_[0]->auto_type->{data_transfer_obfuscation} = boolean($_) },
53             auto_type => sub { }, # TODO - Replace all autotype associations
54             auto_type_enabled => sub { $_[0]->auto_type->{enabled} = boolean($_) },
55             comment => sub { $_[0]->notes($_) },
56             tags => sub { $_[0]->tags($_) },
57             protected => sub { }, # TODO - Replace all protect flags
58             title => sub { $_[0]->title($_) },
59             icon => sub { $_[0]->icon_id($_) },
60             id => sub { $_[0]->uuid(File::KeePass::KDBX::_encode_uuid($_)) },
61             foreground_color => sub { $_[0]->foreground_color($_) },
62             background_color => sub { $_[0]->background_color($_) },
63             url => sub { $_[0]->url($_) },
64             username => sub { $_[0]->username($_) },
65             password => sub { $_[0]->password($_) },
66             history => sub { }, # TODO - Replace all history
67             strings => sub { }, # TODO - Replace all strings
68             binary => sub { }, # TODO - Replace all binaries
69             );
70              
71 770     770 0 3861 sub getters { \%GET }
72 192     192 0 498 sub setters { \%SET }
73              
74             1;
75              
76             __END__