Element/Drawer.pm

filter: Statementstmt 100% 32 / 32 Branchbran 70.0% 7 / 10 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 88.6% 47 / 53 CC 7 SCAR 11.8
CC
7
Cov
91%
BUILD
5.2
_parse_properties
3.0
BEGIN
1.0
CRAP 3.2
« Element/Text.pm ↑ Summary Element/TableHLine.pm »
1 package Org::Element::Drawer;
2  
3 8 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use locale;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 extends 'Org::Element';
8 8 with 'Org::ElementRole';
9 8 with 'Org::ElementRole::Block';
10  
11 8 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
12 8 our $DATE = '2026-07-21'; # DATE
13 8 our $DIST = 'Org-Parser'; # DIST
14 8 our $VERSION = '0.563'; # VERSION
15  
16 8 has name => (is => 'rw');
17 8 has properties => (is => 'rw');
18  
19 15 ▶sub BUILD {
Subroutine BUILD: called CC=5 SCAR=16.4
Pod undocumented
20 15 my ($self, $args) = @_;
21 15 my $doc = $self->document;
22 15 ▶ my $pass = $args->{pass} // 1;
Condition50%1/2
$args->{"pass"} // 1
l!l
150
MC/DC0%0/1
$args->{"pass"} // 1
$args->{"pass"}
Truth table50%1/2
A
A= $args->{"pass"}
Aresult
11
00
23  
24 15 ▶ if ($pass == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pass == 2) 15 0 15
25 15 ▶ unless ($self->document->ignore_unknown_drawers) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->document->ignore_unknown_drawers) 15 0 15
26 $self->die("Unknown drawer name: ".$self->name)
27 15 ▶ unless grep { $_ eq $self->name } @{$doc->drawer_names};
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_ eq $self->name;} @{$doc->drawer_names;} 1 14 15
28 }
29 }
30 }
31  
32 14 ▶sub _parse_properties {
Subroutine _parse_properties: called CC=3 SCAR=11.0
33 14 my ($self, $raw_content) = @_;
34 14 ▶ $self->properties({}) unless $self->properties;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->properties 14 0 14
35 14 ▶ while ($raw_content =~ /^[ \t]*:(\w+):[ \t]+
Branch: 1 branch
BranchTrueFalseTotal
if ($raw_content =~ /^[ \t]*:(\w+):[ \t]+ ($Org::Document::args_re)[ \t]*(?:\R|\z)/glmx) 14 14 28
36 ($Org::Document::args_re)[ \t]*(?:\R|\z)/mxg) {
37 14 $self->properties->{$1} = $2;
38 }
39 }
40  
41 16 ▶sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
42 16 my ($self) = @_;
43 16 join("",
44 ":", $self->name, ":\n",
45 $self->children_as_string,
46 ":END:");
47 }
48  
49 8 1;
50 # ABSTRACT: Represent Org drawer
51  
52 __END__
« Element/Text.pm ↑ Summary Element/TableHLine.pm »