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.037;
2             # ABSTRACT: a file that comes from your filesystem
3              
4 52     52   12031 use Moose;
  52         154  
  52         478  
5             with 'Dist::Zilla::Role::MutableFile', 'Dist::Zilla::Role::StubBuild';
6              
7 52     52   381495 use Dist::Zilla::Pragmas;
  52         130  
  52         528  
8              
9 52     52   1096 use Dist::Zilla::Path;
  52         160  
  52         633  
10              
11 52     52   17901 use namespace::autoclean;
  52         115  
  52         512  
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   1369 my ($self) = @_;
35 587         20375 return path($self->_original_name)->slurp_raw;
36             }
37              
38 652     652   21516 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.037
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
71             released in the last two to three years. (That is, if the most recently
72             released version is v5.40, then this module should work on both v5.40 and
73             v5.38.)
74              
75             Although it may work on older versions of perl, no guarantee is made that the
76             minimum required version will not be increased. The version may be increased
77             for any reason, and there is no promise that patches will be accepted to
78             lower the minimum required perl.
79              
80             =head1 AUTHOR
81              
82             Ricardo SIGNES 😏 <cpan@semiotic.systems>
83              
84             =head1 COPYRIGHT AND LICENSE
85              
86             This software is copyright (c) 2026 by Ricardo SIGNES.
87              
88             This is free software; you can redistribute it and/or modify it under
89             the same terms as the Perl 5 programming language system itself.
90              
91             =cut