| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 3 |  |  | 3 |  | 6389635 | use strict; | 
|  | 3 |  |  |  |  | 10 |  | 
|  | 3 |  |  |  |  | 100 |  | 
| 2 | 3 |  |  | 3 |  | 18 | use warnings; | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 195 |  | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | package Dist::Zilla::Plugin::Test::UnusedVars; # git description: v2.001000-2-g97f4bf1 | 
| 5 |  |  |  |  |  |  | # ABSTRACT: Release tests for unused variables | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = '2.001001'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 3 |  |  | 3 |  | 21 | use Path::Tiny; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 186 |  | 
| 10 | 3 |  |  | 3 |  | 24 | use Moose; | 
|  | 3 |  |  |  |  | 9 |  | 
|  | 3 |  |  |  |  | 27 |  | 
| 11 | 3 |  |  | 3 |  | 20953 | use Sub::Exporter::ForMethods 'method_installer'; | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 40 |  | 
| 12 | 3 |  |  | 3 |  | 782 | use Data::Section 0.004 { installer => method_installer }, '-setup'; | 
|  | 3 |  |  |  |  | 128 |  | 
|  | 3 |  |  |  |  | 24 |  | 
| 13 | 3 |  |  | 3 |  | 2732 | use namespace::autoclean; | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 41 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | with qw( | 
| 16 |  |  |  |  |  |  | Dist::Zilla::Role::FileGatherer | 
| 17 |  |  |  |  |  |  | Dist::Zilla::Role::TextTemplate | 
| 18 |  |  |  |  |  |  | Dist::Zilla::Role::PrereqSource | 
| 19 |  |  |  |  |  |  | ); | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | has files => ( | 
| 22 |  |  |  |  |  |  | is  => 'ro', | 
| 23 |  |  |  |  |  |  | isa => 'Maybe[ArrayRef[Str]]', | 
| 24 |  |  |  |  |  |  | predicate => 'has_files', | 
| 25 |  |  |  |  |  |  | ); | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 5 |  |  | 5 | 0 | 127813 | sub mvp_multivalue_args { return qw/ files / } | 
| 28 | 5 |  |  | 5 | 0 | 783 | sub mvp_aliases { return { file => 'files' } } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub gather_files { | 
| 31 | 5 |  |  | 5 | 0 | 241079 | my $self = shift; | 
| 32 | 5 |  |  |  |  | 15 | my $file = 'xt/release/unused-vars.t'; | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 5 |  |  |  |  | 1766 | require Dist::Zilla::File::InMemory; | 
| 35 |  |  |  |  |  |  | $self->add_file( | 
| 36 |  |  |  |  |  |  | Dist::Zilla::File::InMemory->new({ | 
| 37 |  |  |  |  |  |  | name    => $file, | 
| 38 |  |  |  |  |  |  | content => $self->fill_in_string( | 
| 39 | 5 |  |  |  |  | 46 | ${ $self->section_data($file) }, | 
| 40 |  |  |  |  |  |  | { | 
| 41 |  |  |  |  |  |  | has_files => $self->has_files, | 
| 42 |  |  |  |  |  |  | files => ($self->has_files | 
| 43 | 5 | 100 |  |  |  | 278490 | ? [ map path($_)->relative('lib')->stringify, @{ $self->files } ] | 
|  | 2 |  |  |  |  | 76 |  | 
| 44 |  |  |  |  |  |  | : [] | 
| 45 |  |  |  |  |  |  | ), | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  | ), | 
| 48 |  |  |  |  |  |  | }) | 
| 49 |  |  |  |  |  |  | ); | 
| 50 |  |  |  |  |  |  | }; | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | sub register_prereqs { | 
| 53 | 5 |  |  | 5 | 0 | 27878 | my $self = shift; | 
| 54 |  |  |  |  |  |  |  | 
| 55 | 5 |  |  |  |  | 163 | $self->zilla->register_prereqs( | 
| 56 |  |  |  |  |  |  | { | 
| 57 |  |  |  |  |  |  | phase => 'develop', | 
| 58 |  |  |  |  |  |  | type  => 'requires', | 
| 59 |  |  |  |  |  |  | }, | 
| 60 |  |  |  |  |  |  | 'Test::Vars' => 0, | 
| 61 |  |  |  |  |  |  | ); | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 65 |  |  |  |  |  |  | 1; | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | #pod =pod | 
| 68 |  |  |  |  |  |  | #pod | 
| 69 |  |  |  |  |  |  | #pod =for Pod::Coverage mvp_multivalue_args mvp_aliases gather_files register_prereqs | 
| 70 |  |  |  |  |  |  | #pod | 
| 71 |  |  |  |  |  |  | #pod =head1 SYNOPSIS | 
| 72 |  |  |  |  |  |  | #pod | 
| 73 |  |  |  |  |  |  | #pod In your F<dist.ini>: | 
| 74 |  |  |  |  |  |  | #pod | 
| 75 |  |  |  |  |  |  | #pod     [Test::UnusedVars] | 
| 76 |  |  |  |  |  |  | #pod | 
| 77 |  |  |  |  |  |  | #pod Or, give a list of files to test: | 
| 78 |  |  |  |  |  |  | #pod | 
| 79 |  |  |  |  |  |  | #pod     [Test::UnusedVars] | 
| 80 |  |  |  |  |  |  | #pod     file = lib/My/Module.pm | 
| 81 |  |  |  |  |  |  | #pod     file = bin/verify-this | 
| 82 |  |  |  |  |  |  | #pod | 
| 83 |  |  |  |  |  |  | #pod =head1 DESCRIPTION | 
| 84 |  |  |  |  |  |  | #pod | 
| 85 |  |  |  |  |  |  | #pod This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the | 
| 86 |  |  |  |  |  |  | #pod following file: | 
| 87 |  |  |  |  |  |  | #pod | 
| 88 |  |  |  |  |  |  | #pod     xt/release/unused-vars.t - a standard Test::Vars test | 
| 89 |  |  |  |  |  |  | #pod | 
| 90 |  |  |  |  |  |  | #pod =cut | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | =pod | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =encoding UTF-8 | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | =head1 NAME | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | Dist::Zilla::Plugin::Test::UnusedVars - Release tests for unused variables | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | =head1 VERSION | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | version 2.001001 | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | In your F<dist.ini>: | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | [Test::UnusedVars] | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | Or, give a list of files to test: | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | [Test::UnusedVars] | 
| 113 |  |  |  |  |  |  | file = lib/My/Module.pm | 
| 114 |  |  |  |  |  |  | file = bin/verify-this | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the | 
| 119 |  |  |  |  |  |  | following file: | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | xt/release/unused-vars.t - a standard Test::Vars test | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =for Pod::Coverage mvp_multivalue_args mvp_aliases gather_files register_prereqs | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | =head1 SUPPORT | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-UnusedVars> | 
| 128 |  |  |  |  |  |  | (or L<bug-Dist-Zilla-Plugin-Test-UnusedVars@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-Test-UnusedVars@rt.cpan.org>). | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | There is also a mailing list available for users of this distribution, at | 
| 131 |  |  |  |  |  |  | L<http://dzil.org/#mailing-list>. | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | There is also an irc channel available for users of this distribution, at | 
| 134 |  |  |  |  |  |  | L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>. | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | =head1 AUTHORS | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | =over 4 | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | =item * | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | Marcel Grünauer <marcel@cpan.org> | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | =item * | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | Mike Doherty <doherty@cpan.org> | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | =back | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =head1 CONTRIBUTORS | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | =for stopwords Karen Etheridge Mike Doherty Marcel Gruenauer Kent Fredric | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | =over 4 | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | =item * | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | Karen Etheridge <ether@cpan.org> | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | =item * | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | Mike Doherty <doherty@cs.dal.ca> | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | =item * | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | Mike Doherty <mike@mikedoherty.ca> | 
| 167 |  |  |  |  |  |  |  | 
| 168 |  |  |  |  |  |  | =item * | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | Marcel Gruenauer <hanekomu@gmail.com> | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | =item * | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | Kent Fredric <kentfredric@gmail.com> | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | =back | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENCE | 
| 179 |  |  |  |  |  |  |  | 
| 180 |  |  |  |  |  |  | This software is copyright (c) 2010 by Mike Doherty. | 
| 181 |  |  |  |  |  |  |  | 
| 182 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 183 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 184 |  |  |  |  |  |  |  | 
| 185 |  |  |  |  |  |  | =cut | 
| 186 |  |  |  |  |  |  |  | 
| 187 |  |  |  |  |  |  | __DATA__ | 
| 188 |  |  |  |  |  |  | ___[ xt/release/unused-vars.t ]___ | 
| 189 |  |  |  |  |  |  | use Test::More 0.96 tests => 1; | 
| 190 |  |  |  |  |  |  | use Test::Vars; | 
| 191 |  |  |  |  |  |  |  | 
| 192 |  |  |  |  |  |  | subtest 'unused vars' => sub { | 
| 193 |  |  |  |  |  |  | {{ | 
| 194 |  |  |  |  |  |  | $has_files | 
| 195 |  |  |  |  |  |  | ? 'my @files = (' . "\n" | 
| 196 |  |  |  |  |  |  | . join(",\n", map q{    '}.$_.q{'}, map { s{'}{\\'}g; $_ } @files) | 
| 197 |  |  |  |  |  |  | . "\n" . ');' . "\n" | 
| 198 |  |  |  |  |  |  | . 'vars_ok($_) for @files;' | 
| 199 |  |  |  |  |  |  | : 'all_vars_ok();' | 
| 200 |  |  |  |  |  |  | }} | 
| 201 |  |  |  |  |  |  | }; |