File Coverage

blib/lib/Dist/Zilla/File/OnDisk.pm
Criterion Covered Total %
statement 15 16 93.7
branch n/a
condition n/a
subroutine 6 7 85.7
pod n/a
total 21 23 91.3


line stmt bran cond sub pod time code
1             # ABSTRACT: a file that comes from your filesystem
2              
3             use Moose;
4 52     52   1194 with 'Dist::Zilla::Role::MutableFile', 'Dist::Zilla::Role::StubBuild';
  52         132  
  52         460  
5              
6             use Dist::Zilla::Pragmas;
7 52     52   350925  
  52         146  
  52         513  
8             use Dist::Zilla::Path;
9 52     52   884  
  52         1990  
  52         550  
10             use namespace::autoclean;
11 52     52   16174  
  52         142  
  52         452  
12             #pod =head1 DESCRIPTION
13             #pod
14             #pod This represents a file stored on disk. Its C<content> attribute is read from
15             #pod the originally given file name when first read, but is then kept in memory and
16             #pod may be altered by plugins.
17             #pod
18             #pod =cut
19              
20             has _original_name => (
21             is => 'ro',
22             writer => '_set_original_name',
23             isa => 'Str',
24             init_arg => undef,
25             );
26              
27             after 'BUILD' => sub {
28             my ($self) = @_;
29             $self->_set_original_name( $self->name );
30             };
31              
32             my ($self) = @_;
33             return path($self->_original_name)->slurp_raw;
34 577     577   1306 }
35 577         17385  
36              
37             # should never be called, as content will always be generated from
38 642     642   18394 # encoded content
39              
40             __PACKAGE__->meta->make_immutable;
41             1;
42 0     0      
43              
44             =pod
45              
46             =encoding UTF-8
47              
48             =head1 NAME
49              
50             Dist::Zilla::File::OnDisk - a file that comes from your filesystem
51              
52             =head1 VERSION
53              
54             version 6.028
55              
56             =head1 DESCRIPTION
57              
58             This represents a file stored on disk. Its C<content> attribute is read from
59             the originally given file name when first read, but is then kept in memory and
60             may be altered by plugins.
61              
62             =head1 PERL VERSION
63              
64             This module should work on any version of perl still receiving updates from
65             the Perl 5 Porters. This means it should work on any version of perl released
66             in the last two to three years. (That is, if the most recently released
67             version is v5.40, then this module should work on both v5.40 and v5.38.)
68              
69             Although it may work on older versions of perl, no guarantee is made that the
70             minimum required version will not be increased. The version may be increased
71             for any reason, and there is no promise that patches will be accepted to lower
72             the minimum required perl.
73              
74             =head1 AUTHOR
75              
76             Ricardo SIGNES 😏 <cpan@semiotic.systems>
77              
78             =head1 COPYRIGHT AND LICENSE
79              
80             This software is copyright (c) 2022 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