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