File Coverage

blib/lib/String/PodQuote.pm
Criterion Covered Total %
statement 18 18 100.0
branch 3 4 75.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 27 28 96.4


line stmt bran cond sub pod time code
1             package String::PodQuote;
2              
3             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
4             our $DATE = '2019-12-15'; # DATE
5             our $DIST = 'String-PodQuote'; # DIST
6             our $VERSION = '0.001'; # VERSION
7              
8 1     1   67207 use 5.010001;
  1         11  
9 1     1   7 use strict;
  1         2  
  1         31  
10 1     1   6 use warnings;
  1         1  
  1         29  
11              
12 1     1   5 use Exporter qw(import);
  1         1  
  1         182  
13             our @EXPORT_OK = qw(pod_quote);
14              
15             sub pod_quote {
16 13 50   13 1 119 my $opts = ref $_[0] eq 'HASH' ? shift : {};
17 13         27 my $text = shift;
18              
19 13         66 $text =~ s{
20             (<|^[=\x09\x20])
21             }{
22 14 100       40 if ($1 eq '<') {
23 5         20 'E'
24             } else {
25 9         45 'E<' . ord($1) . '>'
26             }
27             }egmx;
28 13         61 $text;
29             }
30              
31             1;
32              
33             # ABSTRACT: Quote special characters that might be interpreted by a POD parser
34              
35             __END__