| 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`. Heading 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 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | extends 'Dist::Zilla::Plugin::Manifest::Write'; | |||||||||
| 19 | 1 | our $VERSION = '0.007'; | |||||||||
| 20 | |||||||||||
| 21 | # Overload any method or modify it with all the Moose power, e. g.: | ||||||||||
| 22 | 3 | ▶ | around _file_comment => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 23 | 3 | my ( $orig, $self, $file ) = @_; | |||||||||
| 24 | 3 | my $comment = $self->$orig( $file ); | |||||||||
| 25 | 3 | ▶ | if ( $file->name ne $self->manifest ) { # Avoid infinite recursion. | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 2 | $comment .= sprintf( ' (%d bytes)', length( $file->encoded_content ) ); | |||||||||
| 27 | }; | ||||||||||
| 28 | 3 | return $comment; | |||||||||
| 29 | 1 | }; | |||||||||
| 30 | |||||||||||
| 31 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 32 | 1 | 1; | |||||||||
| 33 | |||||||||||
| 34 | # end of file # | ||||||||||