| 1 | package File::KeePass::KDBX::Tie::Protected; | ||||||||||
| 2 | # ABSTRACT: Entry memory protection flags | ||||||||||
| 3 | |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use boolean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 2 | ▶ | use parent 'File::KeePass::KDBX::Tie::Hash'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 2 | our $VERSION = '0.901'; # VERSION | |||||||||
| 13 | |||||||||||
| 14 | my %GET = ( | ||||||||||
| 15 | 0 | ▶ | comment => sub { $_[0]->string('Notes') ->{protect} ? 1 : 0 }, | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 16 | 2 | ▶ | password => sub { $_[0]->string('Password') ->{protect} ? 1 : 0 }, | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||
| 17 | 0 | ▶ | title => sub { $_[0]->string('Title') ->{protect} ? 1 : 0 }, | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 18 | 0 | ▶ | url => sub { $_[0]->string('URL') ->{protect} ? 1 : 0 }, | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 19 | 2 | ▶ | username => sub { $_[0]->string('UserName') ->{protect} ? 1 : 0 }, | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||
| 20 | 2 | ); | |||||||||
| 21 | my %SET = ( | ||||||||||
| 22 | 0 | ▶ | comment => sub { $_[0]->string('Notes') ->{protect} = boolean($_) }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 23 | 0 | ▶ | password => sub { $_[0]->string('Password') ->{protect} = boolean($_) }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 24 | 0 | ▶ | title => sub { $_[0]->string('Title') ->{protect} = boolean($_) }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 25 | 0 | ▶ | url => sub { $_[0]->string('URL') ->{protect} = boolean($_) }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 26 | 0 | ▶ | username => sub { $_[0]->string('UserName') ->{protect} = boolean($_) }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 27 | 2 | ); | |||||||||
| 28 | |||||||||||
| 29 | 6 | ▶ | sub getters { \%GET } | ||||||||
|
Subroutine
getters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 30 | 0 | ▶ | sub setters { \%SET } | ||||||||
|
Subroutine
setters: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 31 | 2 | ▶ | sub default_getter { my $key = $_[1]; sub { $_[0]->string($key)->{protect} ? 1 : 0 } } | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Subroutine
default_getter: called CC=1 SCAR=0.1
Pod
undocumented
Branch: 1 branch
| |||||||||||
| 32 | 0 | ▶ | sub default_setter { my $key = $_[1]; sub { $_[0]->string($key)->{protect} = boolean($_) } } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
default_setter: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 33 | |||||||||||
| 34 | sub keys { | ||||||||||
| 35 | 22 | ▶ | my $self = shift; | ||||||||
|
Subroutine
keys: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||
| 36 | 22 | my ($entry) = @$self; | |||||||||
| 37 | 22 | my @keys; | |||||||||
| 38 | 22 | ▶ | while (my ($key, $string) = each %{$entry->strings}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 154 | ▶ | $key = 'comment' if $key eq 'Notes'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 154 | ▶ | $key = lc($key) if $key =~ /^(?:Password|Title|URL|UserName)$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 154 | ▶ | push @keys, $key if $string->{protect}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | } | ||||||||||
| 43 | 22 | return \@keys; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 2 | 1; | |||||||||
| 47 | |||||||||||
| 48 | __END__ | ||||||||||