File Coverage

blib/lib/Path/Resolver/SimpleEntity.pm
Criterion Covered Total %
statement 9 13 69.2
branch n/a
condition n/a
subroutine 3 5 60.0
pod 2 2 100.0
total 14 20 70.0


line stmt bran cond sub pod time code
1             package Path::Resolver::SimpleEntity 3.100455;
2             # ABSTRACT: a dead-simple entity to return, only provides content
3 2     2   13 use Moose;
  2         3  
  2         16  
4              
5 2     2   12959 use MooseX::Types::Moose qw(ScalarRef);
  2         94922  
  2         16  
6              
7 2     2   8147 use namespace::autoclean;
  2         4  
  2         9  
8              
9             #pod =head1 SYNOPSIS
10             #pod
11             #pod my $entity = Path::Resolver::SimpleEntity->new({
12             #pod content_ref => \$string,
13             #pod });
14             #pod
15             #pod printf "Content: %s\n", $entity->content;
16             #pod
17             #pod This class is used as an extremely simple way to represent hunks of stringy
18             #pod content.
19             #pod
20             #pod =attr content_ref
21             #pod
22             #pod This is the only real attribute of a SimpleEntity. It's a reference to a
23             #pod string that is the content of the entity.
24             #pod
25             #pod =cut
26              
27             has content_ref => (is => 'ro', isa => ScalarRef, required => 1);
28              
29             #pod =method content
30             #pod
31             #pod This method returns the dereferenced content from the C<content_ref> attribuet.
32             #pod
33             #pod =cut
34              
35 0     0 1   sub content { return ${ $_[0]->content_ref } }
  0            
36              
37             #pod =method length
38             #pod
39             #pod This method returns the length of the content.
40             #pod
41             #pod =cut
42              
43             sub length {
44 0     0 1   length ${ $_[0]->content_ref }
  0            
45             }
46              
47             1;
48              
49             __END__
50              
51             =pod
52              
53             =encoding UTF-8
54              
55             =head1 NAME
56              
57             Path::Resolver::SimpleEntity - a dead-simple entity to return, only provides content
58              
59             =head1 VERSION
60              
61             version 3.100455
62              
63             =head1 SYNOPSIS
64              
65             my $entity = Path::Resolver::SimpleEntity->new({
66             content_ref => \$string,
67             });
68              
69             printf "Content: %s\n", $entity->content;
70              
71             This class is used as an extremely simple way to represent hunks of stringy
72             content.
73              
74             =head1 PERL VERSION
75              
76             This library should run on perls released even a long time ago. It should work
77             on any version of perl released in the last five years.
78              
79             Although it may work on older versions of perl, no guarantee is made that the
80             minimum required version will not be increased. The version may be increased
81             for any reason, and there is no promise that patches will be accepted to lower
82             the minimum required perl.
83              
84             =head1 ATTRIBUTES
85              
86             =head2 content_ref
87              
88             This is the only real attribute of a SimpleEntity. It's a reference to a
89             string that is the content of the entity.
90              
91             =head1 METHODS
92              
93             =head2 content
94              
95             This method returns the dereferenced content from the C<content_ref> attribuet.
96              
97             =head2 length
98              
99             This method returns the length of the content.
100              
101             =head1 AUTHOR
102              
103             Ricardo Signes <cpan@semiotic.systems>
104              
105             =head1 COPYRIGHT AND LICENSE
106              
107             This software is copyright (c) 2022 by Ricardo Signes.
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             =cut