File Coverage

blib/lib/Org/Element/Link.pm
Criterion Covered Total %
statement 14 14 100.0
branch 5 6 83.3
condition 2 3 66.6
subroutine 5 5 100.0
pod 2 2 100.0
total 28 30 93.3


line stmt bran cond sub pod time code
1             package Org::Element::Link;
2              
3 5     5   1094 use 5.010;
  5         17  
4 5     5   25 use locale;
  5         10  
  5         28  
5 5     5   150 use Moo;
  5         9  
  5         28  
6             extends 'Org::Element';
7             with 'Org::ElementRole';
8             with 'Org::ElementRole::Inline';
9              
10             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
11             our $DATE = '2023-07-12'; # DATE
12             our $DIST = 'Org-Parser'; # DIST
13             our $VERSION = '0.559'; # VERSION
14              
15             has link => (is => 'rw');
16             has description => (is => 'rw');
17             has from_radio_target => (is => 'rw');
18              
19             sub as_string {
20 2     2 1 871 my ($self) = @_;
21 2 50       23 return $self->_str if defined $self->_str;
22 2 100 66     21 join("",
23             "[",
24             "[", $self->link, "]",
25             (defined($self->description) && length($self->description) ?
26             ("[", $self->description->as_string, "]") : ()),
27             "]");
28             }
29              
30             sub as_text {
31 2     2 1 2333 my $self = shift;
32 2         5 my $desc = $self->description;
33 2 100       13 defined($desc) ? $desc->as_text : $self->link;
34             }
35              
36             1;
37             # ABSTRACT: Represent Org hyperlink
38              
39             __END__
40              
41             =pod
42              
43             =encoding UTF-8
44              
45             =head1 NAME
46              
47             Org::Element::Link - Represent Org hyperlink
48              
49             =head1 VERSION
50              
51             This document describes version 0.559 of Org::Element::Link (from Perl distribution Org-Parser), released on 2023-07-12.
52              
53             =head1 DESCRIPTION
54              
55             Derived from L<Org::Element>.
56              
57             =head1 as_string => str
58              
59             From L<Org::Element>.
60              
61             =head2 as_text => str
62              
63             From L<Org::ElementRole::Inline>.
64              
65             =head1 ATTRIBUTES
66              
67             =head2 link => STR
68              
69             =head2 description => OBJ
70              
71             =head2 from_radio_target => BOOL
72              
73             =head1 METHODS
74              
75             =head1 HOMEPAGE
76              
77             Please visit the project's homepage at L<https://metacpan.org/release/Org-Parser>.
78              
79             =head1 SOURCE
80              
81             Source repository is at L<https://github.com/perlancar/perl-Org-Parser>.
82              
83             =head1 AUTHOR
84              
85             perlancar <perlancar@cpan.org>
86              
87             =head1 CONTRIBUTING
88              
89              
90             To contribute, you can send patches by email/via RT, or send pull requests on
91             GitHub.
92              
93             Most of the time, you don't need to build the distribution yourself. You can
94             simply modify the code, then test via:
95              
96             % prove -l
97              
98             If you want to build the distribution (e.g. to try to install it locally on your
99             system), you can install L<Dist::Zilla>,
100             L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
101             L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
102             Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
103             that are considered a bug and can be reported to me.
104              
105             =head1 COPYRIGHT AND LICENSE
106              
107             This software is copyright (c) 2023, 2022, 2021, 2020, 2019, 2017, 2016, 2015, 2014, 2013, 2012, 2011 by perlancar <perlancar@cpan.org>.
108              
109             This is free software; you can redistribute it and/or modify it under
110             the same terms as the Perl 5 programming language system itself.
111              
112             =head1 BUGS
113              
114             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Org-Parser>
115              
116             When submitting a bug or request, please include a test-file or a
117             patch to an existing test-file that illustrates the bug or desired
118             feature.
119              
120             =cut