File Coverage

blib/lib/Dist/Zilla/Plugin/SurgicalPodWeaver.pm
Criterion Covered Total %
statement 7 7 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 10 100.0


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::SurgicalPodWeaver;
2             BEGIN {
3 1     1   880 $Dist::Zilla::Plugin::SurgicalPodWeaver::VERSION = '0.0019';
4             }
5             # ABSTRACT: Surgically apply PodWeaver
6              
7              
8 1     1   12 use Moose;
  1         2  
  1         12  
9             extends qw/ Dist::Zilla::Plugin::PodWeaver /;
10              
11             require Dist::Zilla::PluginBundle::ROKR;
12              
13             around munge_pod => sub {
14             my $inner = shift;
15             my ( $self, $file ) = @_;
16              
17             my $content = $file->content;
18              
19             my $yes = 0;
20             if ( my $hint = Dist::Zilla::PluginBundle::ROKR->parse_hint( $content ) ) {
21             if ( exists $hint->{PodWeaver} ) {
22             return unless $hint->{PodWeaver};
23             $yes = 1;
24             }
25             }
26              
27             if ( $yes || $content =~ m/^\s*#+\s*(?:ABSTRACT):\s*(.+)$/m ) { }
28             else { return }
29              
30             return $inner->( @_ )
31             };
32              
33             __PACKAGE__->meta->make_immutable;
34 1     1   8027 no Moose;
  1         4  
  1         8  
35             1;
36              
37              
38             __END__
39             =pod
40              
41             =head1 NAME
42              
43             Dist::Zilla::Plugin::SurgicalPodWeaver - Surgically apply PodWeaver
44              
45             =head1 VERSION
46              
47             version 0.0019
48              
49             =head1 SYNOPSIS
50              
51             In your L<Dist::Zilla> C<dist.ini>:
52              
53             [SurgicalPodWeaver]
54              
55             To hint that you want to apply PodWeaver:
56              
57             package Xyzzy;
58             # Dist::Zilla: +PodWeaver
59              
60             ...
61              
62             =head1 DESCRIPTION
63              
64             Dist::Zilla::Plugin::SurgicalPodWeaver will only PodWeaver a .pm if:
65              
66             1. There exists an # ABSTRACT: ...
67             2. The +PodWeaver hint is present
68              
69             You can forcefully disable PodWeaver on a .pm by using the C<-PodWeaver> hint
70              
71             =head1 AUTHOR
72              
73             Robert Krimen <robertkrimen@gmail.com>
74              
75             =head1 COPYRIGHT AND LICENSE
76              
77             This software is copyright (c) 2011 by Robert Krimen.
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut
83