| 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
MC/DC0%0/1
$args->{"pass"} // 1
$args->{"pass"}
Truth table50%1/2
A
A= $args->{"pass"}
| |||||||||||||
| 23 | |||||||||||||
| 24 | 15 | ▶ | if ($pass == 2) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | 15 | ▶ | unless ($self->document->ignore_unknown_drawers) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 26 | $self->die("Unknown drawer name: ".$self->name) | ||||||||||||
| 27 | 15 | ▶ | unless grep { $_ eq $self->name } @{$doc->drawer_names}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 35 | 14 | ▶ | while ($raw_content =~ /^[ \t]*:(\w+):[ \t]+ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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__ | ||||||||||||