File Coverage

Makefile.PL
Criterion Covered Total %
statement 7 73 9.5
branch 0 48 0.0
condition 0 6 0.0
subroutine 3 8 37.5
pod n/a
total 10 135 7.4


line stmt bran cond sub pod time code
1             # -*- mode: perl; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2            
3 1     1   418 use strict;
  1         3  
  1         32  
4 1     1   791 use ExtUtils::MakeMaker qw(WriteMakefile);
  1         107685  
  1         1179  
5             # See lib/ExtUtils/MakeMaker.pm for details of how to influence
6             # the contents of the Makefile that is written.
7            
8             # Normalize version strings like 6.30_02 to 6.3002,
9             # so that we can do numerical comparisons on it.
10             my $eumm_version = $ExtUtils::MakeMaker::VERSION;
11             $eumm_version =~ s/_//;
12            
13             my $module = 'WWW::Google::Login';
14             (my $main_file = "lib/$module.pm" ) =~ s!::!/!g;
15             (my $distbase = $module) =~ s!::!-!g;
16            
17             my @tests = map { glob $_ } 't/*.t', 't/*/*.t';
18            
19             my %module = (
20             NAME => $module,
21             AUTHOR => q{Max Maischein },
22             VERSION_FROM => $main_file,
23             ABSTRACT_FROM => $main_file,
24             META_MERGE => {
25             "meta-spec" => { version => 2 },
26             resources => {
27             repository => {
28             web => "https://github.com/Corion/$distbase",
29             url => "git://github.com/Corion/$distbase.git",
30             type => 'git',
31             }
32             },
33             dynamic_config => 0, # we promise to keep META.* up-to-date
34             x_static_install => 1, # we are pure Perl and don't do anything fancy
35             },
36            
37             MIN_PERL_VERSION => '5.010', # I use // in some places
38            
39             'LICENSE'=> 'perl',
40            
41             PL_FILES => {},
42             BUILD_REQUIRES => {
43             'ExtUtils::MakeMaker' => 0,
44             },
45            
46             PREREQ_PM => {
47             'Moo' => 2, # for some hashes-as-objects
48             'WWW::Mechanize::Chrome' => '0.22',
49             'Filter::signatures' => '0.10',
50            
51             },
52             TEST_REQUIRES => {
53             'Test::More' => 0,
54             },
55            
56             dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
57             clean => { FILES => "$distbase-*" },
58            
59             test => { TESTS => join( ' ', @tests ) },
60             );
61            
62             # This is so that we can do
63             # require 'Makefile.PL'
64             # and then call get_module_info
65            
66 1     1   12 sub get_module_info { %module }
67            
68             if( ! caller ) {
69             # I should maybe use something like Shipwright...
70             regen_README($main_file);
71             #regen_EXAMPLES();
72             WriteMakefile1(get_module_info);
73             };
74            
75             1;
76            
77             sub WriteMakefile1 { #Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
78 0     0     my %params=@_;
79 0           my $eumm_version=$ExtUtils::MakeMaker::VERSION;
80 0           $eumm_version=eval $eumm_version;
81 0 0         die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
82 0 0         die "License not specified" if not exists $params{LICENSE};
83 0 0 0       if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
84             #EUMM 6.5502 has problems with BUILD_REQUIRES
85 0 0         $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
  0            
  0            
86 0           delete $params{BUILD_REQUIRES};
87             }
88 0 0 0       if ($params{TEST_REQUIRES} and $eumm_version < 6.64) {
89 0 0         $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{TEST_REQUIRES}} };
  0            
  0            
90 0           delete $params{TEST_REQUIRES};
91             }
92 0 0         delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52;
93 0 0         delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
94 0 0         delete $params{META_MERGE} if $eumm_version < 6.46;
95 0 0         delete $params{META_ADD} if $eumm_version < 6.46;
96 0 0         delete $params{LICENSE} if $eumm_version < 6.31;
97 0 0         delete $params{AUTHOR} if $] < 5.005;
98 0 0         delete $params{ABSTRACT_FROM} if $] < 5.005;
99 0 0         delete $params{BINARY_LOCATION} if $] < 5.005;
100            
101 0           WriteMakefile(%params);
102             }
103            
104             sub regen_README {
105             # README is the short version that just tells people what this is
106             # and how to install it
107 0     0     eval {
108             # Get description
109 0           my $readme = join "\n",
110             pod_section($_[0], 'NAME', 'no heading' ),
111             pod_section($_[0], 'DESCRIPTION' ),
112             <
113            
114             INSTALLATION
115            
116             This is a Perl module distribution. It should be installed with whichever
117             tool you use to manage your installation of Perl, e.g. any of
118            
119             cpanm .
120             cpan .
121             cpanp -i .
122            
123             Consult http://www.cpan.org/modules/INSTALL.html for further instruction.
124             Should you wish to install this module manually, the procedure is
125            
126             perl Makefile.PL
127             make
128             make test
129             make install
130            
131             INSTALL
132             pod_section($_[0], 'REPOSITORY'),
133             pod_section($_[0], 'SUPPORT'),
134             pod_section($_[0], 'TALKS'),
135             pod_section($_[0], 'KNOWN ISSUES'),
136             pod_section($_[0], 'BUG TRACKER'),
137             pod_section($_[0], 'CONTRIBUTING'),
138             pod_section($_[0], 'SEE ALSO'),
139             pod_section($_[0], 'AUTHOR'),
140             pod_section($_[0], 'LICENSE' ),
141             pod_section($_[0], 'COPYRIGHT' ),
142             ;
143 0           update_file( 'README', $readme );
144             };
145             # README.mkdn is the documentation that will be shown as the main
146             # page of the repository on Github. Hence we recreate the POD here
147             # as Markdown
148 0           eval {
149 0           require Pod::Markdown;
150            
151 0           my $parser = Pod::Markdown->new();
152            
153             # Read POD from Module.pm and write to README
154 0           $parser->parse_from_file($_[0]);
155 0           my $readme_mkdn = <as_markdown;
156            
157             [![Travis Build Status](https://travis-ci.org/Corion/$distbase.svg?branch=master)](https://travis-ci.org/Corion/$distbase)
158             [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/Corion/$distbase?branch=master&svg=true)](https://ci.appveyor.com/project/Corion/$distbase)
159            
160             CONTRIBUTING
161            
162             STATUS
163 0           update_file( 'README.mkdn', $readme_mkdn );
164             };
165             }
166            
167             sub pod_section {
168 0     0     my( $filename, $section, $remove_heading ) = @_;
169 0 0         open my $fh, '<', $filename
170             or die "Couldn't read '$filename': $!";
171            
172             my @section =
173 0           grep { /^=head1\s+$section/.../^=/ } <$fh>;
  0            
174 0 0         pop @section if $section[-1] =~ /^=/;
175 0 0         shift @section if $remove_heading;
176            
177             # Trim the section
178 0 0         if( @section ) {
179             pop @section
180 0           while $section[-1] =~ /^\s*$/;
181             shift @section
182 0           while $section[0] =~ /^\s*$/;
183             };
184            
185 0           @section = map { $_ =~ s!^=\w+\s+!!; $_ } @section;
  0            
  0            
186 0           return join "", @section;
187             }
188            
189             sub regen_EXAMPLES {
190 0     0     my $perl = $^X;
191 0 0         if ($perl =~/\s/) {
192 0           $perl = qq{"$perl"};
193             };
194 0           my $examples = `$perl -w examples/gen_examples_pod.pl`;
195 0 0         if ($examples) {
196 0           warn "(Re)Creating lib/WWW/Mechanize/Chrome/Examples.pm\n";
197 0           $examples =~ s/\r\n/\n/g;
198 0           update_file( 'lib/WWW/Mechanize/Chrome/Examples.pm', $examples );
199             };
200             };
201            
202             sub update_file {
203 0     0     my( $filename, $new_content ) = @_;
204 0           my $content;
205 0 0         if( -f $filename ) {
206 0 0         open my $fh, '<', $filename
207             or die "Couldn't read '$filename': $!";
208 0           binmode $fh;
209 0           local $/;
210 0           $content = <$fh>;
211             };
212            
213 0 0         if( $content ne $new_content ) {
214 0 0         if( open my $fh, '>', $filename ) {
215 0           binmode $fh;
216 0           print $fh $new_content;
217             } else {
218 0           warn "Couldn't (re)write '$filename': $!";
219             };
220             };
221             }