| 1 | package File::KDBX::Group; | ||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: A KDBX database group | ||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Devel::GlobalDestruction; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use File::KDBX::Constants qw(:bool :icon :iteration); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use File::KDBX::Error; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use File::KDBX::Iterator; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 10 | ▶ | use File::KDBX::Util qw(:assert :class :coercion generate_uuid); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use Hash::Util::FieldHash; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | use List::Util qw(any sum0); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use Ref::Util qw(is_coderef is_ref); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 15 | 10 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 10 | ▶ | use Time::Piece 1.33; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | 10 | ▶ | use boolean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 18 | 10 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 10 | extends 'File::KDBX::Object'; | |||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 10 | our $VERSION = '0.905'; # VERSION | |||||||||||||||||||||||||||||||
| 23 | 230 | ▶ | |||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=4 SCAR=14.2
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 24 | 230 | ▶ | |||||||||||||||||||||||||||||||
|
Subroutine
notes: called CC=4 SCAR=14.1
Pod
documented
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 25 | 230 | ▶ | # has uuid => sub { generate_uuid(printable => 1) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tags: called CC=4 SCAR=14.1
Pod
documented
Branch: 2 branches
Condition66%2/3
$_[0]{"name"} //= $default
MC/DC50%1/2
$_[0]{"name"} //= $default
$_[0]{"name"}
$default
Truth table66%2/3
A //= B
A= $_[0]{"name"}B= $default
| |||||||||||||||||||||||||||||||||
| 26 | 149 | ▶ | has name => '', coerce => \&to_string; | ||||||||||||||||||||||||||||||
|
Subroutine
icon_id: called CC=4 SCAR=14.2
Pod
documented
Branch: 2 branches
Condition66%2/3
$_[0]{"notes"} //= $default
MC/DC50%1/2
$_[0]{"notes"} //= $default
$_[0]{"notes"}
$default
Truth table66%2/3
A //= B
A= $_[0]{"notes"}B= $default
| |||||||||||||||||||||||||||||||||
| 27 | 237 | ▶ | has notes => '', coerce => \&to_string; | ||||||||||||||||||||||||||||||
|
Subroutine
custom_icon_uuid: called CC=4 SCAR=14.3
Pod
documented
Branch: 2 branches
Condition66%2/3
$_[0]{"tags"} //= $default
MC/DC50%1/2
$_[0]{"tags"} //= $default
$_[0]{"tags"}
$default
Truth table66%2/3
A //= B
A= $_[0]{"tags"}B= $default
| |||||||||||||||||||||||||||||||||
| 28 | 103 | ▶ | has tags => '', coerce => \&to_string; | ||||||||||||||||||||||||||||||
|
Subroutine
is_expanded: called CC=4 SCAR=14.5
Pod
documented
Branch: 2 branches
Condition66%2/3
$_[0]{"icon_id"} //= $default
MC/DC0%0/2
$_[0]{"icon_id"} //= $default
$_[0]{"icon_id"}
$default
Truth table66%2/3
A //= B
A= $_[0]{"icon_id"}B= $default
| |||||||||||||||||||||||||||||||||
| 29 | 88 | ▶ | has icon_id => ICON_FOLDER, coerce => \&to_icon_constant; | ||||||||||||||||||||||||||||||
|
Subroutine
default_auto_type_sequence: called CC=4 SCAR=14.3
Pod
documented
Branch: 2 branches
Condition50%1/2
$_[0]{"custom_icon_uuid"} //= undef
MC/DC0%0/1
$_[0]{"custom_icon_uuid"} //= undef
$_[0]{"custom_icon_uuid"}
Truth table50%1/2
A
A= $_[0]{"custom_icon_uuid"}
| |||||||||||||||||||||||||||||||||
| 30 | 148 | ▶ | has custom_icon_uuid => undef, coerce => \&to_uuid; | ||||||||||||||||||||||||||||||
|
Subroutine
enable_auto_type: called CC=4 SCAR=14.1
Pod
documented
Branch: 2 branches
Condition66%2/3
$_[0]{"is_expanded"} //= $default
MC/DC50%1/2
$_[0]{"is_expanded"} //= $default
$_[0]{"is_expanded"}
$default
Truth table66%2/3
A //= B
A= $_[0]{"is_expanded"}B= $default
| |||||||||||||||||||||||||||||||||
| 31 | 84 | ▶ | has is_expanded => false, coerce => \&to_bool; | ||||||||||||||||||||||||||||||
|
Subroutine
enable_searching: called CC=4 SCAR=14.0
Pod
documented
Branch: 2 branches
Condition66%2/3
$_[0]{"default_auto_type_sequence"} //= $default
MC/DC50%1/2
$_[0]{"default_auto_type_sequence"} //= $default
$_[0]{"default_auto_type_sequence"}
$default
Truth table66%2/3
A //= B
A= $_[0]{"default_auto_type_sequence"}B= $default
| |||||||||||||||||||||||||||||||||
| 32 | 85 | ▶ | has default_auto_type_sequence => '', coerce => \&to_string; | ||||||||||||||||||||||||||||||
|
Subroutine
last_top_visible_entry: called CC=4 SCAR=14.0
Pod
documented
Branch: 2 branches
Condition100%2/2
$_[0]{"enable_auto_type"} //= undef
MC/DC100%1/1
$_[0]{"enable_auto_type"} //= undef
$_[0]{"enable_auto_type"}
Truth table100%2/2
A
A= $_[0]{"enable_auto_type"}
| |||||||||||||||||||||||||||||||||
| 33 | 86 | ▶ | has enable_auto_type => undef, coerce => \&to_tristate; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$_[0]{"enable_searching"} //= undef
MC/DC100%1/1
$_[0]{"enable_searching"} //= undef
$_[0]{"enable_searching"}
Truth table100%2/2
A
A= $_[0]{"enable_searching"}
| |||||||||||||||||||||||||||||||||
| 34 | 80 | ▶ | has enable_searching => undef, coerce => \&to_tristate; | ||||||||||||||||||||||||||||||
|
Subroutine
previous_parent_group: called CC=4 SCAR=14.0
Pod
documented
Branch: 1 branch
Condition50%1/2
$_[0]{"last_top_visible_entry"} //= undef
MC/DC0%0/1
$_[0]{"last_top_visible_entry"} //= undef
$_[0]{"last_top_visible_entry"}
Truth table50%1/2
A
A= $_[0]{"last_top_visible_entry"}
| |||||||||||||||||||||||||||||||||
| 35 | 238 | ▶ | has last_top_visible_entry => undef, coerce => \&to_uuid; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 36 | 238 | ▶ | # has custom_data => {}; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$_[0]{"previous_parent_group"} //= undef
MC/DC100%1/1
$_[0]{"previous_parent_group"} //= undef
$_[0]{"previous_parent_group"}
Truth table100%2/2
A
A= $_[0]{"previous_parent_group"}
| |||||||||||||||||||||||||||||||||
| 37 | 668 | ▶ | has previous_parent_group => undef, coerce => \&to_uuid; | ||||||||||||||||||||||||||||||
|
Subroutine
times: called CC=4 SCAR=14.3
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 38 | 668 | ▶ | # has entries => []; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 39 | 668 | ▶ | # has groups => []; | ||||||||||||||||||||||||||||||
|
Subroutine
last_modification_time: called CC=4 SCAR=14.1
Pod
documented
Branch: 1 branch
Condition100%2/2
$_[0]{"times"} //= scalar &$default($_[0])
MC/DC100%1/1
$_[0]{"times"} //= scalar &$default($_[0])
$_[0]{"times"}
Truth table100%2/2
A
A= $_[0]{"times"}
| |||||||||||||||||||||||||||||||||
| 40 | 86 | ▶ | has times => {}; | ||||||||||||||||||||||||||||||
|
Subroutine
creation_time: called CC=4 SCAR=14.1
Pod
documented
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 41 | 86 | ▶ | |||||||||||||||||||||||||||||||
|
Subroutine
last_access_time: called CC=4 SCAR=14.1
Pod
documented
Branch: 2 branches
Condition100%2/2
$_[0]->times->{"last_modification_time"} //= scalar &$default($_[0])
MC/DC100%1/1
$_[0]->times->{"last_modification_time"} //= scalar &$default($_[0])
$_[0]->times->{"last_modification_time"}
Truth table100%2/2
A
A= $_[0]->times->{"last_modification_time"}
| |||||||||||||||||||||||||||||||||
| 42 | 80 | ▶ | has last_modification_time => sub { gmtime }, store => 'times', coerce => \&to_time; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Subroutine
expiry_time: called CC=4 SCAR=14.2
Pod
documented
Branch: 2 branches
Condition50%1/2
$_[0]->times->{"creation_time"} //= scalar &$default($_[0])
MC/DC0%0/1
$_[0]->times->{"creation_time"} //= scalar &$default($_[0])
$_[0]->times->{"creation_time"}
Truth table50%1/2
A
A= $_[0]->times->{"creation_time"}
| |||||||||||||||||||||||||||||||||
| 43 | 86 | ▶ | has creation_time => sub { gmtime }, store => 'times', coerce => \&to_time; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Subroutine
expires: called CC=4 SCAR=14.4
Pod
documented
Branch: 2 branches
Condition100%2/2
$_[0]->times->{"last_access_time"} //= scalar &$default($_[0])
MC/DC100%1/1
$_[0]->times->{"last_access_time"} //= scalar &$default($_[0])
$_[0]->times->{"last_access_time"}
Truth table100%2/2
A
A= $_[0]->times->{"last_access_time"}
| |||||||||||||||||||||||||||||||||
| 44 | 80 | ▶ | has last_access_time => sub { gmtime }, store => 'times', coerce => \&to_time; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Subroutine
usage_count: called CC=4 SCAR=14.8
Pod
documented
Branch: 2 branches
Condition50%1/2
$_[0]->times->{"expiry_time"} //= scalar &$default($_[0])
MC/DC0%0/1
$_[0]->times->{"expiry_time"} //= scalar &$default($_[0])
$_[0]->times->{"expiry_time"}
Truth table50%1/2
A
A= $_[0]->times->{"expiry_time"}
| |||||||||||||||||||||||||||||||||
| 45 | 84 | ▶ | has expiry_time => sub { gmtime }, store => 'times', coerce => \&to_time; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Subroutine
location_changed: called CC=4 SCAR=14.8
Pod
documented
Branch: 2 branches
Condition66%2/3
$_[0]->times->{"expires"} //= $default
MC/DC50%1/2
$_[0]->times->{"expires"} //= $default
$_[0]->times->{"expires"}
$default
Truth table66%2/3
A //= B
A= $_[0]->times->{"expires"}B= $default
| |||||||||||||||||||||||||||||||||
| 46 | 80 | ▶ | has expires => false, store => 'times', coerce => \&to_bool; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_[0]->times->{"usage_count"} //= $default
MC/DC0%0/2
$_[0]->times->{"usage_count"} //= $default
$_[0]->times->{"usage_count"}
$default
Truth table33%1/3
A //= B
A= $_[0]->times->{"usage_count"}B= $default
| |||||||||||||||||||||||||||||||||
| 47 | 80 | ▶ | has usage_count => 0, store => 'times', coerce => \&to_number; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$_[0]->times->{"location_changed"} //= scalar &$default($_[0])
MC/DC0%0/1
$_[0]->times->{"location_changed"} //= scalar &$default($_[0])
$_[0]->times->{"location_changed"}
Truth table50%1/2
A
A= $_[0]->times->{"location_changed"}
| |||||||||||||||||||||||||||||||||
| 48 | 80 | ▶ | has location_changed => sub { gmtime }, store => 'times', coerce => \&to_time; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | 10 | my @ATTRS = qw(uuid custom_data entries groups); | |||||||||||||||||||||||||||||||
| 51 | sub _set_nonlazy_attributes { | ||||||||||||||||||||||||||||||||
| 52 | 80 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
_set_nonlazy_attributes: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 53 | 80 | $self->$_ for @ATTRS, list_attributes(ref $self); | |||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | sub uuid { | ||||||||||||||||||||||||||||||||
| 57 | 273 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
uuid: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 58 | 273 | ▶ | if (@_ || !defined $self->{uuid}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@_ or not defined $self->{"uuid"}
MC/DC100%2/2
@_ or not defined $self->{"uuid"}
@_
not defined $self->{"uuid"}
Truth table100%3/3
A or not(B)
A= @_B= not defined $self->{"uuid"}
| |||||||||||||||||||||||||||||||||
| 59 | 81 | ▶ | my %args = @_ % 2 == 1 ? (uuid => shift, @_) : @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 60 | 81 | my $old_uuid = $self->{uuid}; | |||||||||||||||||||||||||||||||
| 61 | 81 | ▶ | my $uuid = $self->{uuid} = delete $args{uuid} // generate_uuid; | ||||||||||||||||||||||||||||||
|
Condition66%2/3
delete $args{"uuid"} // generate_uuid()
MC/DC0%0/2
delete $args{"uuid"} // generate_uuid()
delete $args{"uuid"}
generate_uuid()
Truth table66%2/3
A // B
A= delete $args{"uuid"}B= generate_uuid()
| |||||||||||||||||||||||||||||||||
| 62 | 81 | ▶ | $self->_signal('uuid.changed', $uuid, $old_uuid) if defined $old_uuid; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||
| 64 | 273 | $self->{uuid}; | |||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||
| 67 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | sub entries { | ||||||||||||||||||||||||||||||||
| 71 | 830 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
entries: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 72 | 830 | ▶ | my $entries = $self->{entries} //= []; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"entries"} //= []
MC/DC100%1/1
$self->{"entries"} //= []
$self->{"entries"}
Truth table100%2/2
A
A= $self->{"entries"}
| |||||||||||||||||||||||||||||||||
| 73 | 830 | ▶ | if (@$entries && !blessed($entries->[0])) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@$entries and not builtin::blessed($entries->[0])
MC/DC100%2/2
@$entries and not builtin::blessed($entries->[0])
@$entries
not builtin::blessed($entries->[0])
Truth table100%3/3
A and not(B)
A= @$entriesB= not builtin::blessed($entries->[0])
| |||||||||||||||||||||||||||||||||
| 74 | 12 | @$entries = map { $self->_wrap_entry($_, $self->kdbx) } @$entries; | |||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||
| 76 | 830 | ▶ | assert { !any { !blessed $_ } @$entries }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
| |||||||||||||||||||||||||||||||||
| 77 | 830 | return $entries; | |||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | sub all_entries { | ||||||||||||||||||||||||||||||||
| 82 | 205 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
all_entries: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 83 | 205 | my %args = @_; | |||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | 205 | my $searching = delete $args{searching}; | |||||||||||||||||||||||||||||||
| 86 | 205 | my $auto_type = delete $args{auto_type}; | |||||||||||||||||||||||||||||||
| 87 | 205 | my $history = delete $args{history}; | |||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | 205 | my $groups = $self->all_groups(%args); | |||||||||||||||||||||||||||||||
| 90 | 205 | my @entries; | |||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||
| 92 | return File::KDBX::Iterator->new(sub { | ||||||||||||||||||||||||||||||||
| 93 | 335 | ▶ | if (!@entries) { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=23.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 94 | 282 | ▶ | while (my $group = $groups->next) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 95 | 312 | ▶ | next if $searching && !$group->effective_enable_searching; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$searching and not $group->effective_enable_searching
MC/DC50%1/2
$searching and not $group->effective_enable_searching
$searching
not $group->effective_enable_searching
Truth table66%2/3
A and not(B)
A= $searchingB= not $group->effective_enable_searching
| |||||||||||||||||||||||||||||||||
| 96 | 311 | ▶ | next if $auto_type && !$group->effective_enable_auto_type; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$auto_type and not $group->effective_enable_auto_type
MC/DC0%0/2
$auto_type and not $group->effective_enable_auto_type
$auto_type
not $group->effective_enable_auto_type
Truth table33%1/3
A and not(B)
A= $auto_typeB= not $group->effective_enable_auto_type
| |||||||||||||||||||||||||||||||||
| 97 | 311 | @entries = @{$group->entries}; | |||||||||||||||||||||||||||||||
| 98 | 311 | ▶ | @entries = grep { $_->auto_type->{enabled} } @entries if $auto_type; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 99 | 311 | ▶ | @entries = map { ($_, @{$_->history}) } @entries if $history; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 100 | 311 | ▶ | last if @entries; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||
| 103 | 335 | shift @entries; | |||||||||||||||||||||||||||||||
| 104 | 205 | }); | |||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||
| 108 | sub add_entry { | ||||||||||||||||||||||||||||||||
| 109 | 29 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
add_entry: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 110 | 29 | ▶ | my $entry = @_ % 2 == 1 ? shift : undef; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 111 | 29 | my %args = @_; | |||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | 29 | ▶ | my $kdbx = delete $args{kdbx} // eval { $self->kdbx }; | ||||||||||||||||||||||||||||||
|
Condition66%2/3
delete $args{"kdbx"} // eval {
do {
$self->kdbx
}
}
MC/DC0%0/2
delete $args{"kdbx"} // eval {
do {
$self->kdbx
}
}
delete $args{"kdbx"}
eval {
do {
$self->kdbx
}
}
Truth table66%2/3
A // B
A= delete $args{"kdbx"}B= eval {
do {
$self->kdbx
}
}
| |||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||
| 115 | 29 | ▶ | $entry = $self->_wrap_entry($entry // [%args]); | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$entry // [%args]
MC/DC100%1/1
$entry // [%args]
$entry
Truth table100%2/2
A
A= $entry
| |||||||||||||||||||||||||||||||||
| 116 | 29 | $entry->uuid; | |||||||||||||||||||||||||||||||
| 117 | 29 | ▶ | $entry->kdbx($kdbx) if $kdbx; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||
| 119 | 29 | ▶ | push @{$self->{entries} ||= []}, $entry->remove; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"entries"} ||= []
MC/DC0%0/1
$self->{"entries"} ||= []
$self->{"entries"}
Truth table50%1/2
A
A= $self->{"entries"}
| |||||||||||||||||||||||||||||||||
| 120 | 29 | return $entry->_set_group($self)->_signal('added', $self); | |||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||
| 124 | sub remove_entry { | ||||||||||||||||||||||||||||||||
| 125 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
remove_entry: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 126 | 4 | ▶ | my $uuid = is_ref($_[0]) ? $self->_wrap_entry(shift)->uuid : shift; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 127 | 4 | my %args = @_; | |||||||||||||||||||||||||||||||
| 128 | 4 | my $objects = $self->{entries}; | |||||||||||||||||||||||||||||||
| 129 | 4 | ▶ | for (my $i = 0; $i < @$objects; ++$i) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 130 | 4 | my $object = $objects->[$i]; | |||||||||||||||||||||||||||||||
| 131 | 4 | ▶ | next if $uuid ne $object->uuid; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 132 | 4 | $object->_set_group(undef); | |||||||||||||||||||||||||||||||
| 133 | 4 | ▶ | $object->_signal('removed') if $args{signal} // 1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$args{"signal"} // 1
MC/DC100%1/1
$args{"signal"} // 1
$args{"signal"}
Truth table100%2/2
A
A= $args{"signal"}
| |||||||||||||||||||||||||||||||||
| 134 | 4 | return splice @$objects, $i, 1; | |||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||
| 138 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||
| 141 | sub groups { | ||||||||||||||||||||||||||||||||
| 142 | 1207 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
groups: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 143 | 1207 | ▶ | my $groups = $self->{groups} //= []; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"groups"} //= []
MC/DC100%1/1
$self->{"groups"} //= []
$self->{"groups"}
Truth table100%2/2
A
A= $self->{"groups"}
| |||||||||||||||||||||||||||||||||
| 144 | 1207 | ▶ | if (@$groups && !blessed($groups->[0])) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@$groups and not builtin::blessed($groups->[0])
MC/DC100%2/2
@$groups and not builtin::blessed($groups->[0])
@$groups
not builtin::blessed($groups->[0])
Truth table100%3/3
A and not(B)
A= @$groupsB= not builtin::blessed($groups->[0])
| |||||||||||||||||||||||||||||||||
| 145 | 7 | @$groups = map { $self->_wrap_group($_, $self->kdbx) } @$groups; | |||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||
| 147 | 1207 | ▶ | assert { !any { !blessed $_ } @$groups }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
| |||||||||||||||||||||||||||||||||
| 148 | 1207 | return $groups; | |||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||
| 152 | sub all_groups { | ||||||||||||||||||||||||||||||||
| 153 | 444 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
all_groups: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 154 | 444 | my %args = @_; | |||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||
| 156 | 444 | ▶ | my @groups = ($args{inclusive} // 1) ? $self : @{$self->groups}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$args{"inclusive"} // 1
MC/DC0%0/1
$args{"inclusive"} // 1
$args{"inclusive"}
Truth table50%1/2
A
A= $args{"inclusive"}
| |||||||||||||||||||||||||||||||||
| 157 | 444 | ▶ | my $algo = lc($args{algorithm} || 'ids'); | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'algorithm'} || 'ids'
MC/DC100%1/1
$args{'algorithm'} || 'ids'
$args{'algorithm'}
Truth table100%2/2
A
A= $args{'algorithm'}
| |||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||
| 159 | 444 | ▶ | if ($algo eq ITERATION_DFS) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 160 | 4 | my %visited; | |||||||||||||||||||||||||||||||
| 161 | return File::KDBX::Iterator->new(sub { | ||||||||||||||||||||||||||||||||
| 162 | 21 | ▶ | my $next = shift @groups or return; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 163 | 17 | ▶ | if (!$visited{Hash::Util::FieldHash::id($next)}++) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 164 | 9 | ▶ | while (my @children = @{$next->groups}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 165 | 8 | unshift @groups, @children, $next; | |||||||||||||||||||||||||||||||
| 166 | 8 | $next = shift @groups; | |||||||||||||||||||||||||||||||
| 167 | 8 | $visited{Hash::Util::FieldHash::id($next)}++; | |||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||
| 170 | 17 | $next; | |||||||||||||||||||||||||||||||
| 171 | 4 | }); | |||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||
| 173 | elsif ($algo eq ITERATION_BFS) { | ||||||||||||||||||||||||||||||||
| 174 | return File::KDBX::Iterator->new(sub { | ||||||||||||||||||||||||||||||||
| 175 | 15 | ▶ | my $next = shift @groups or return; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 176 | 12 | push @groups, @{$next->groups}; | |||||||||||||||||||||||||||||||
| 177 | 12 | $next; | |||||||||||||||||||||||||||||||
| 178 | 3 | }); | |||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||
| 180 | return File::KDBX::Iterator->new(sub { | ||||||||||||||||||||||||||||||||
| 181 | 1025 | ▶ | my $next = shift @groups or return; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 182 | 632 | unshift @groups, @{$next->groups}; | |||||||||||||||||||||||||||||||
| 183 | 632 | $next; | |||||||||||||||||||||||||||||||
| 184 | 437 | }); | |||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | sub _kpx_groups { shift->groups(@_) } | ||||||||||||||||||||||||||||||
|
Subroutine
_kpx_groups: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||
| 190 | sub add_group { | ||||||||||||||||||||||||||||||||
| 191 | 19 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
add_group: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 192 | 19 | ▶ | my $group = @_ % 2 == 1 ? shift : undef; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 193 | 19 | my %args = @_; | |||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||
| 195 | 19 | ▶ | my $kdbx = delete $args{kdbx} // eval { $self->kdbx }; | ||||||||||||||||||||||||||||||
|
Condition66%2/3
delete $args{"kdbx"} // eval {
do {
$self->kdbx
}
}
MC/DC0%0/2
delete $args{"kdbx"} // eval {
do {
$self->kdbx
}
}
delete $args{"kdbx"}
eval {
do {
$self->kdbx
}
}
Truth table66%2/3
A // B
A= delete $args{"kdbx"}B= eval {
do {
$self->kdbx
}
}
| |||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||
| 197 | 19 | ▶ | $group = $self->_wrap_group($group // [%args]); | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$group // [%args]
MC/DC100%1/1
$group // [%args]
$group
Truth table100%2/2
A
A= $group
| |||||||||||||||||||||||||||||||||
| 198 | 19 | $group->uuid; | |||||||||||||||||||||||||||||||
| 199 | 19 | ▶ | $group->kdbx($kdbx) if $kdbx; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||
| 201 | 19 | ▶ | push @{$self->{groups} ||= []}, $group->remove; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"groups"} ||= []
MC/DC0%0/1
$self->{"groups"} ||= []
$self->{"groups"}
Truth table50%1/2
A
A= $self->{"groups"}
| |||||||||||||||||||||||||||||||||
| 202 | 19 | return $group->_set_group($self)->_signal('added', $self); | |||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||
| 206 | sub remove_group { | ||||||||||||||||||||||||||||||||
| 207 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
remove_group: called CC=6 SCAR=18.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 208 | 3 | ▶ | my $uuid = is_ref($_[0]) ? $self->_wrap_group(shift)->uuid : shift; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 209 | 3 | my %args = @_; | |||||||||||||||||||||||||||||||
| 210 | 3 | my $objects = $self->{groups}; | |||||||||||||||||||||||||||||||
| 211 | 3 | ▶ | for (my $i = 0; $i < @$objects; ++$i) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 212 | 3 | my $object = $objects->[$i]; | |||||||||||||||||||||||||||||||
| 213 | 3 | ▶ | next if $uuid ne $object->uuid; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 214 | 3 | $object->_set_group(undef); | |||||||||||||||||||||||||||||||
| 215 | 3 | ▶ | $object->_signal('removed') if $args{signal} // 1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$args{"signal"} // 1
MC/DC0%0/1
$args{"signal"} // 1
$args{"signal"}
Truth table50%1/2
A
A= $args{"signal"}
| |||||||||||||||||||||||||||||||||
| 216 | 3 | return splice @$objects, $i, 1; | |||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||
| 220 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||
| 223 | sub all_objects { | ||||||||||||||||||||||||||||||||
| 224 | 106 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
all_objects: called CC=1 SCAR=0.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 225 | 106 | my %args = @_; | |||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||
| 227 | 106 | my $searching = delete $args{searching}; | |||||||||||||||||||||||||||||||
| 228 | 106 | my $auto_type = delete $args{auto_type}; | |||||||||||||||||||||||||||||||
| 229 | 106 | my $history = delete $args{history}; | |||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||
| 231 | 106 | my $groups = $self->all_groups(%args); | |||||||||||||||||||||||||||||||
| 232 | 106 | my @entries; | |||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||
| 234 | return File::KDBX::Iterator->new(sub { | ||||||||||||||||||||||||||||||||
| 235 | 284 | ▶ | if (!@entries) { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=23.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 236 | 247 | ▶ | while (my $group = $groups->next) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 237 | 152 | ▶ | next if $searching && !$group->effective_enable_searching; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$searching and not $group->effective_enable_searching
MC/DC0%0/2
$searching and not $group->effective_enable_searching
$searching
not $group->effective_enable_searching
Truth table33%1/3
A and not(B)
A= $searchingB= not $group->effective_enable_searching
| |||||||||||||||||||||||||||||||||
| 238 | 152 | ▶ | next if $auto_type && !$group->effective_enable_auto_type; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$auto_type and not $group->effective_enable_auto_type
MC/DC0%0/2
$auto_type and not $group->effective_enable_auto_type
$auto_type
not $group->effective_enable_auto_type
Truth table33%1/3
A and not(B)
A= $auto_typeB= not $group->effective_enable_auto_type
| |||||||||||||||||||||||||||||||||
| 239 | 152 | @entries = @{$group->entries}; | |||||||||||||||||||||||||||||||
| 240 | 152 | ▶ | @entries = grep { $_->auto_type->{enabled} } @entries if $auto_type; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 241 | 152 | ▶ | @entries = map { ($_, @{$_->history}) } @entries if $history; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 242 | 152 | return $group; | |||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||
| 245 | 132 | shift @entries; | |||||||||||||||||||||||||||||||
| 246 | 106 | }); | |||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||
| 250 | sub add_object { | ||||||||||||||||||||||||||||||||
| 251 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
add_object: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 252 | 4 | my $obj = shift; | |||||||||||||||||||||||||||||||
| 253 | 4 | ▶ | if ($obj->isa('File::KDBX::Entry')) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 254 | 3 | $self->add_entry($obj); | |||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||
| 256 | elsif ($obj->isa('File::KDBX::Group')) { | ||||||||||||||||||||||||||||||||
| 257 | 1 | $self->add_group($obj); | |||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||
| 262 | sub remove_object { | ||||||||||||||||||||||||||||||||
| 263 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
remove_object: called CC=6 SCAR=21.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 264 | 7 | my $object = shift; | |||||||||||||||||||||||||||||||
| 265 | 7 | my $blessed = blessed($object); | |||||||||||||||||||||||||||||||
| 266 | 7 | ▶ | return $self->remove_group($object, @_) if $blessed && $object->isa('File::KDBX::Group'); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$blessed and $object->isa("File::KDBX::Group")
MC/DC50%1/2
$blessed and $object->isa("File::KDBX::Group")
$blessed
$object->isa("File::KDBX::Group")
Truth table66%2/3
A and B
A= $blessedB= $object->isa("File::KDBX::Group")
| |||||||||||||||||||||||||||||||||
| 267 | 4 | ▶ | return $self->remove_entry($object, @_) if $blessed && $object->isa('File::KDBX::Entry'); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$blessed and $object->isa("File::KDBX::Entry")
MC/DC0%0/2
$blessed and $object->isa("File::KDBX::Entry")
$blessed
$object->isa("File::KDBX::Entry")
Truth table33%1/3
A and B
A= $blessedB= $object->isa("File::KDBX::Entry")
| |||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | return $self->remove_group($object, @_) || $self->remove_entry($object, @_); | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->remove_group($object, @_) || $self->remove_entry($object, @_)
MC/DC0%0/2
$self->remove_group($object, @_) || $self->remove_entry($object, @_)
$self->remove_group($object, @_)
$self->remove_entry($object, @_)
Truth table0%0/3
A || B
A= $self->remove_group($object, @_)B= $self->remove_entry($object, @_)
| |||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||
| 271 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||
| 274 | sub effective_default_auto_type_sequence { | ||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
effective_default_auto_type_sequence: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 276 | 0 | my $sequence = $self->default_auto_type_sequence; | |||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | return $sequence if defined $sequence; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | my $parent = $self->group or return '{USERNAME}{TAB}{PASSWORD}{ENTER}'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 280 | 0 | return $parent->effective_default_auto_type_sequence; | |||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||
| 284 | sub effective_enable_auto_type { | ||||||||||||||||||||||||||||||||
| 285 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
effective_enable_auto_type: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 286 | 1 | my $enabled = $self->enable_auto_type; | |||||||||||||||||||||||||||||||
| 287 | 1 | ▶ | return $enabled if defined $enabled; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||
| 289 | 1 | ▶ | my $parent = $self->group or return true; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 290 | 0 | return $parent->effective_enable_auto_type; | |||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||
| 294 | sub effective_enable_searching { | ||||||||||||||||||||||||||||||||
| 295 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
effective_enable_searching: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||
| 296 | 2 | my $enabled = $self->enable_searching; | |||||||||||||||||||||||||||||||
| 297 | 2 | ▶ | return $enabled if defined $enabled; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||
| 299 | 1 | ▶ | my $parent = $self->group or return true; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 300 | 0 | return $parent->effective_enable_searching; | |||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||
| 303 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||
| 306 | sub is_empty { | ||||||||||||||||||||||||||||||||
| 307 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
is_empty: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 308 | 5 | ▶ | return @{$self->groups} == 0 && @{$self->entries} == 0; | ||||||||||||||||||||||||||||||
|
Condition100%3/3
@{$self->groups;} == 0 && @{$self->entries;} == 0
MC/DC100%2/2
@{$self->groups;} == 0 && @{$self->entries;} == 0
@{$self->groups;} == 0
@{$self->entries;} == 0
Truth table100%3/3
A && B
A= @{$self->groups;} == 0B= @{$self->entries;} == 0
| |||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||
| 312 | sub is_root { | ||||||||||||||||||||||||||||||||
| 313 | 8 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
is_root: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 314 | 8 | ▶ | my $kdbx = eval { $self->kdbx } or return FALSE; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 315 | 8 | return Hash::Util::FieldHash::id($kdbx->root) == Hash::Util::FieldHash::id($self); | |||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||
| 319 | sub is_recycle_bin { | ||||||||||||||||||||||||||||||||
| 320 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
is_recycle_bin: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||
| 321 | 5 | ▶ | my $kdbx = eval { $self->kdbx } or return FALSE; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 322 | 5 | my $group = $kdbx->recycle_bin; | |||||||||||||||||||||||||||||||
| 323 | 5 | ▶ | return $group && Hash::Util::FieldHash::id($group) == Hash::Util::FieldHash::id($self); | ||||||||||||||||||||||||||||||
|
Condition66%2/3
$group && &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
MC/DC50%1/2
$group && &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
$group
&Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
Truth table66%2/3
A && B
A= $groupB= &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
| |||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||
| 327 | sub is_entry_templates { | ||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
is_entry_templates: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | my $kdbx = eval { $self->kdbx } or return FALSE; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 330 | 0 | my $group = $kdbx->entry_templates; | |||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | return $group && Hash::Util::FieldHash::id($group) == Hash::Util::FieldHash::id($self); | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$group && &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
MC/DC0%0/2
$group && &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
$group
&Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
Truth table0%0/3
A && B
A= $groupB= &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
| |||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||
| 335 | sub is_last_selected { | ||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
is_last_selected: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | my $kdbx = eval { $self->kdbx } or return FALSE; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 338 | 0 | my $group = $kdbx->last_selected; | |||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | return $group && Hash::Util::FieldHash::id($group) == Hash::Util::FieldHash::id($self); | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$group && &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
MC/DC0%0/2
$group && &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
$group
&Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
Truth table0%0/3
A && B
A= $groupB= &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
| |||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||
| 343 | sub is_last_top_visible { | ||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
is_last_top_visible: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | my $kdbx = eval { $self->kdbx } or return FALSE; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 346 | 0 | my $group = $kdbx->last_top_visible; | |||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | return $group && Hash::Util::FieldHash::id($group) == Hash::Util::FieldHash::id($self); | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$group && &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
MC/DC0%0/2
$group && &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
$group
&Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
Truth table0%0/3
A && B
A= $groupB= &Hash::Util::FieldHash::id($group) == &Hash::Util::FieldHash::id($self)
| |||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||
| 351 | sub path { | ||||||||||||||||||||||||||||||||
| 352 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
path: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 353 | 3 | ▶ | return $self->name if $self->is_root; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 354 | 2 | ▶ | my $lineage = $self->lineage or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 355 | 2 | my @parts = (@$lineage, $self); | |||||||||||||||||||||||||||||||
| 356 | 2 | shift @parts; | |||||||||||||||||||||||||||||||
| 357 | 2 | return join('.', map { $_->name } @parts); | |||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||
| 361 | sub size { | ||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 363 | 0 | return sum0 map { $_->size } @{$self->groups}, @{$self->entries}; | |||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | sub depth { $_[0]->is_root ? 0 : (scalar @{$_[0]->lineage || []} || -1) } | ||||||||||||||||||||||||||||||
|
Subroutine
depth: not called CC=4 SCAR=30.0
Pod
documented
Branch: 2 branches
Condition0%0/2
scalar @{$_[0]->lineage or [];} or -1
MC/DC0%0/1
scalar @{$_[0]->lineage or [];} or -1
scalar @{$_[0]->lineage or [];}
Truth table0%0/2
A
A= scalar @{$_[0]->lineage or [];}
| |||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||
| 369 | sub _signal { | ||||||||||||||||||||||||||||||||
| 370 | 23 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
_signal: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 371 | 23 | my $type = shift; | |||||||||||||||||||||||||||||||
| 372 | 23 | return $self->SUPER::_signal("group.$type", @_); | |||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||
| 375 | sub _commit { | ||||||||||||||||||||||||||||||||
| 376 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
_commit: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 377 | 6 | my $time = gmtime; | |||||||||||||||||||||||||||||||
| 378 | 6 | $self->last_modification_time($time); | |||||||||||||||||||||||||||||||
| 379 | 6 | $self->last_access_time($time); | |||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||
| 382 | 65 | ▶ | sub label { shift->name(@_) } | ||||||||||||||||||||||||||||||
|
Subroutine
label: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||
| 384 | ### Name of the parent attribute expected to contain the object | ||||||||||||||||||||||||||||||||
| 385 | 9 | ▶ | sub _parent_container { 'groups' } | ||||||||||||||||||||||||||||||
|
Subroutine
_parent_container: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||
| 387 | 10 | 1; | |||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||
| 389 | __END__ | ||||||||||||||||||||||||||||||||