Element/Block.pm

filter: Statementstmt 86.6% 26 / 30 Branchbran 33.3% 2 / 6 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 2 totaltotal 59.2% 32 / 54 CC 7 SCAR 31.6
CC
7
Cov
65%
element_as_string
42.0
BUILD
2.0
BEGIN
1.0
CRAP 23.5
« Element/Setting.pm ↑ Summary Element/Headline.pm »
1 package Org::Element::Block;
2  
3 4 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use locale;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 extends 'Org::Element';
8 4 with 'Org::ElementRole';
9 4 with 'Org::ElementRole::Block';
10  
11 4 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
12 4 our $DATE = '2026-07-21'; # DATE
13 4 our $DIST = 'Org-Parser'; # DIST
14 4 our $VERSION = '0.563'; # VERSION
15  
16 4 has name => (is => 'rw');
17 4 has args => (is => 'rw');
18 4 has raw_content => (is => 'rw');
19 4 has begin_indent => (is => 'rw');
20 4 has end_indent => (is => 'rw');
21  
22 4 my @known_blocks = qw(
23 ASCII CENTER COMMENT EXAMPLE HTML
24 LATEX QUOTE SRC VERSE
25 );
26  
27 3 ▶sub BUILD {
Subroutine BUILD: called CC=2 SCAR=6.9
Pod undocumented
28 3 my ($self, $args) = @_;
29 3 $self->name(uc $self->name);
30 3 ▶ (grep { $_ eq $self->name } @known_blocks)
Branch: 1 branch
BranchTrueFalseTotal
grep {$_ eq $self->name;} @known_blocks or $self->die('Unknown block name: ' . $self->name) 2 1 3
31 or $self->die("Unknown block name: ".$self->name);
32 }
33  
34 0 ▶sub element_as_string {
Subroutine element_as_string: not called CC=6 SCAR=37.4
Pod undocumented
35 0 my ($self) = @_;
36 0 ▶ return $self->_str if defined $self->_str;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->_str 0 0 0
37 join("",
38 $self->begin_indent // "",
39 "#+BEGIN_".uc($self->name),
40 0 ▶ $self->args && @{$self->args} ?
Branch: 1 branch
BranchTrueFalseTotal
$self->args && @{$self->args;} ? : 0 0 0
Condition0%0/7
$self->begin_indent // ""
l!l
00
$self->args and @{$self->args;}
!ll&&!rl&&r
000
$self->end_indent // ""
l!l
00
MC/DC0%0/1
$self->begin_indent // ""
$self->begin_indent
MC/DC0%0/2
$self->args and @{$self->args;}
$self->args @{$self->args;}
MC/DC0%0/1
$self->end_indent // ""
$self->end_indent
Truth table0%0/2
A
A= $self->begin_indent
Aresult
11
00
Truth table0%0/3
A and B
A= $self->argsB= @{$self->args;}
ABresult
0X0
100
111
Truth table0%0/2
A
A= $self->end_indent
Aresult
11
00
41 " ".Org::Document::__format_args($self->args) : "",
42 "\n",
43 $self->raw_content,
44 $self->end_indent // "",
45 "#+END_".uc($self->name)."\n");
46 }
47  
48 4 1;
49 # ABSTRACT: Represent Org block
50  
51 __END__
« Element/Setting.pm ↑ Summary Element/Headline.pm »