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             package Dist::Zilla::File::OnDisk 6.029;
2             # ABSTRACT: a file that comes from your filesystem
3              
4 52     52   1202 use Moose;
  52         160  
  52         421  
5             with 'Dist::Zilla::Role::MutableFile', 'Dist::Zilla::Role::StubBuild';
6              
7 52     52   355802 use Dist::Zilla::Pragmas;
  52         158  
  52         467  
8              
9 52     52   896 use Dist::Zilla::Path;
  52         132  
  52         576  
10              
11 52     52   16703 use namespace::autoclean;
  52         179  
  52         431  
12              
13             #pod =head1 DESCRIPTION
14             #pod
15             #pod This represents a file stored on disk. Its C<content> attribute is read from
16             #pod the originally given file name when first read, but is then kept in memory and
17             #pod may be altered by plugins.
18             #pod
19             #pod =cut
20              
21             has _original_name => (
22             is => 'ro',
23             writer => '_set_original_name',
24             isa => 'Str',
25             init_arg => undef,
26             );
27              
28             after 'BUILD' => sub {
29             my ($self) = @_;
30             $self->_set_original_name( $self->name );
31             };
32              
33             sub _build_encoded_content {
34 587     587   1400 my ($self) = @_;
35 587         17938 return path($self->_original_name)->slurp_raw;
36             }
37              
38 652     652   19382 sub _build_content_source { return "encoded_content" }
39              
40             # should never be called, as content will always be generated from
41             # encoded content
42 0     0     sub _build_content { die "shouldn't reach here" }
43              
44             __PACKAGE__->meta->make_immutable;
45             1;
46              
47             __END__
48              
49             =pod
50              
51             =encoding UTF-8
52              
53             =head1 NAME
54              
55             Dist::Zilla::File::OnDisk - a file that comes from your filesystem
56              
57             =head1 VERSION
58              
59             version 6.029
60              
61             =head1 DESCRIPTION
62              
63             This represents a file stored on disk. Its C<content> attribute is read from
64             the originally given file name when first read, but is then kept in memory and
65             may be altered by plugins.
66              
67             =head1 PERL VERSION
68              
69             This module should work on any version of perl still receiving updates from
70             the Perl 5 Porters. This means it should work on any version of perl released
71             in the last two to three years. (That is, if the most recently released
72             version is v5.40, then this module should work on both v5.40 and v5.38.)
73              
74             Although it may work on older versions of perl, no guarantee is made that the
75             minimum required version will not be increased. The version may be increased
76             for any reason, and there is no promise that patches will be accepted to lower
77             the minimum required perl.
78              
79             =head1 AUTHOR
80              
81             Ricardo SIGNES 😏 <cpan@semiotic.systems>
82              
83             =head1 COPYRIGHT AND LICENSE
84              
85             This software is copyright (c) 2022 by Ricardo SIGNES.
86              
87             This is free software; you can redistribute it and/or modify it under
88             the same terms as the Perl 5 programming language system itself.
89              
90             =cut