File Coverage

eg/ManifestWithFileSize.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             # ------------------------------------------------------------------------------------------------
2             #
3             # file: ex/ManifestWithFileSize.pm
4             #
5             # This file is part of perl-Dist-Zilla-Plugin-Manifest-Write.
6             #
7             # ------------------------------------------------------------------------------------------------
8             #
9             # This module is used as synopsis in `Dist/Zilla/Plugin/Manifest/Write.pm`. Heding and trailing
10             # comments are stripped. Having this module in a separate file allows us to test it, see
11             # `t/examples.t`.
12             #
13              
14             package ManifestWithFileSize;
15              
16 1     1   3646332 use Moose;
  1         4  
  1         12  
17 1     1   9362 use namespace::autoclean;
  1         4  
  1         16  
18             extends 'Dist::Zilla::Plugin::Manifest::Write';
19             our $VERSION = '0.007';
20              
21             # Overload any method or modify it with all the Moose power, e. g.:
22             around _file_comment => sub {
23             my ( $orig, $self, $file ) = @_;
24             my $comment = $self->$orig( $file );
25             if ( $file->name ne $self->manifest ) { # Avoid infinite recursion.
26             $comment .= sprintf( ' (%d bytes)', length( $file->encoded_content ) );
27             };
28             return $comment;
29             };
30              
31             __PACKAGE__->meta->make_immutable;
32             1;
33              
34             # end of file #