Kit/Role/KitReader.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 95.2% 20 / 21 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
get_decoded_kit_entry
1.0
CRAP 1.0
« Kit/KitReader/Dir.pm ↑ Summary Kit/ManifestReader/JSON.pm »
1 package Email::MIME::Kit::Role::KitReader 3.000007;
2 # ABSTRACT: things that can read kit contents
3  
4 6 ▶use v5.20.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 with 'Email::MIME::Kit::Role::Component';
7  
8 #pod =head1 IMPLEMENTING
9 #pod
10 #pod This role also performs L<Email::MIME::Kit::Role::Component>.
11 #pod
12 #pod Classes implementing this role must provide a C<get_kit_entry> method. It will
13 #pod be called with one parameter, the name of a path to an entry in the kit. It
14 #pod should return a reference to a scalar holding the contents (as octets) of the
15 #pod named entry. If no entry is found, it should raise an exception.
16 #pod
17 #pod A method called C<get_decoded_kit_entry> is provided. It behaves like
18 #pod C<get_kit_entry>, but assumes that the entry for that name is stored in UTF-8
19 #pod and will decode it to text before returning.
20 #pod
21 #pod =cut
22  
23 6 requires 'get_kit_entry';
24  
25 sub get_decoded_kit_entry {
26 6 ▶ my ($self, $name) = @_;
Subroutine get_decoded_kit_entry: called CC=1 SCAR=0.0
Pod undocumented
27 6 my $content_ref = $self->get_kit_entry($name);
28  
29 6 require Encode;
30 6 my $decoded = Encode::decode('utf-8', $$content_ref);
31 6 return \$decoded;
32 }
33  
34 6 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 6 1;
36  
37 __END__
38  
39 =pod
40  
41 =encoding UTF-8
42  
43 =head1 NAME
44  
45 Email::MIME::Kit::Role::KitReader - things that can read kit contents
46  
47 =head1 VERSION
48  
49 version 3.000007
50  
51 =head1 PERL VERSION
52  
53 This library should run on perls released even a long time ago. It should work
54 on any version of perl released in the last five years.
55  
56 Although it may work on older versions of perl, no guarantee is made that the
57 minimum required version will not be increased. The version may be increased
58 for any reason, and there is no promise that patches will be accepted to lower
59 the minimum required perl.
60  
61 =head1 IMPLEMENTING
62  
63 This role also performs L<Email::MIME::Kit::Role::Component>.
64  
65 Classes implementing this role must provide a C<get_kit_entry> method. It will
66 be called with one parameter, the name of a path to an entry in the kit. It
67 should return a reference to a scalar holding the contents (as octets) of the
68 named entry. If no entry is found, it should raise an exception.
69  
70 A method called C<get_decoded_kit_entry> is provided. It behaves like
71 C<get_kit_entry>, but assumes that the entry for that name is stored in UTF-8
72 and will decode it to text before returning.
73  
74 =head1 AUTHOR
75  
76 Ricardo Signes <rjbs@cpan.org>
77  
78 =head1 COPYRIGHT AND LICENSE
79  
80 This software is copyright (c) 2023 by Ricardo Signes.
81  
82 This is free software; you can redistribute it and/or modify it under
83 the same terms as the Perl 5 programming language system itself.
84  
85 =cut
« Kit/KitReader/Dir.pm ↑ Summary Kit/ManifestReader/JSON.pm »