| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Text::Safer; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
270766
|
use 5.010001; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
71
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
73
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
3
|
use Exporter qw(import); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
160
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
10
|
|
|
|
|
|
|
our $DATE = '2025-06-14'; # DATE |
|
11
|
|
|
|
|
|
|
our $DIST = 'Text-Safer'; # DIST |
|
12
|
|
|
|
|
|
|
our $VERSION = '0.003'; # VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(encode_safer); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub encode_safer { |
|
17
|
0
|
|
|
0
|
1
|
|
my ($text, $encoding, $encoding_args) = @_; |
|
18
|
0
|
|
0
|
|
|
|
$encoding //= "alphanum_kebab_nodashend_lc"; |
|
19
|
0
|
|
0
|
|
|
|
$encoding_args //= {}; |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $module = "Text::Safer::$encoding"; |
|
22
|
0
|
|
|
|
|
|
(my $module_pm = "$module.pm") =~ s!::!/!g; |
|
23
|
0
|
|
|
|
|
|
require $module_pm; |
|
24
|
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
8
|
no strict 'refs'; ## no critic: TestingAndDebugging::ProhibitNoStrict |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
121
|
|
|
26
|
0
|
|
|
|
|
|
&{"$module\::encode_safer"}($text, $encoding_args); |
|
|
0
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
|
30
|
|
|
|
|
|
|
# ABSTRACT: Convert text with one of several available methods, usually to a safer/more restricted encoding, e.g. for filenames |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |