File Coverage

blib/lib/Dist/Zilla/File/InMemory.pm
Criterion Covered Total %
statement 9 12 75.0
branch n/a
condition n/a
subroutine 3 6 50.0
pod n/a
total 12 18 66.6


line stmt bran cond sub pod time code
1             # ABSTRACT: a file that you build entirely in memory
2              
3             use Moose;
4 21     21   2888  
  21         891942  
  21         162  
5             use Dist::Zilla::Pragmas;
6 21     21   135672  
  21         60  
  21         152  
7             use namespace::autoclean;
8 21     21   174  
  21         77  
  21         144  
9             #pod =head1 DESCRIPTION
10             #pod
11             #pod This represents a file created in memory -- it's not much more than a glorified
12             #pod string.
13             #pod
14             #pod See L<Dist::Zilla::Role::MutableFile> for details.
15             #pod
16             #pod =cut
17              
18             with 'Dist::Zilla::Role::MutableFile', 'Dist::Zilla::Role::StubBuild';
19              
20             after 'BUILD' => sub {
21             my ($self,$opts) = @_;
22             my @sources = qw/encoded_content content/;
23             my @given = grep { exists $opts->{$_} } @sources;
24             unless ( @given == 1 ) {
25             $self->log_fatal(__PACKAGE__ . " requires have one and only one of: @sources");
26             }
27             my $source = $given[0];
28             my $setter = "_$source";
29             $self->_content_source($source);
30             $self->$setter( $opts->{$source} );
31             };
32              
33             # these should never be called since we ensure one of _content or
34             # _encoded_content content is set in BUILD and set the source accordingly
35              
36              
37 0     0     __PACKAGE__->meta->make_immutable;
38 0     0     1;
39 0     0      
40              
41             =pod
42              
43             =encoding UTF-8
44              
45             =head1 NAME
46              
47             Dist::Zilla::File::InMemory - a file that you build entirely in memory
48              
49             =head1 VERSION
50              
51             version 6.028
52              
53             =head1 DESCRIPTION
54              
55             This represents a file created in memory -- it's not much more than a glorified
56             string.
57              
58             See L<Dist::Zilla::Role::MutableFile> for details.
59              
60             =head1 PERL VERSION
61              
62             This module should work on any version of perl still receiving updates from
63             the Perl 5 Porters. This means it should work on any version of perl released
64             in the last two to three years. (That is, if the most recently released
65             version is v5.40, then this module should work on both v5.40 and v5.38.)
66              
67             Although it may work on older versions of perl, no guarantee is made that the
68             minimum required version will not be increased. The version may be increased
69             for any reason, and there is no promise that patches will be accepted to lower
70             the minimum required perl.
71              
72             =head1 AUTHOR
73              
74             Ricardo SIGNES 😏 <cpan@semiotic.systems>
75              
76             =head1 COPYRIGHT AND LICENSE
77              
78             This software is copyright (c) 2022 by Ricardo SIGNES.
79              
80             This is free software; you can redistribute it and/or modify it under
81             the same terms as the Perl 5 programming language system itself.
82              
83             =cut