1# This -*- perl -*- script makes the Makefile
2# Based on the Makefile.PL in the libwww-perl distribution
3# $Id: Makefile.PL 231 2007-02-26 15:51:46Z graaff $
4
5require 5.005;
6use strict;
7use ExtUtils::MakeMaker;
8
9
10my $missing_modules = 0;
11
12print "\nChecking for LWP...........";
13eval {
14    require LWP;
15    LWP->VERSION(5.803);
16};
17if ($@) {
18    print " failed\n";
19    $missing_modules++;
20    print <<EOT;
21$@
22Checkbot depends on LWP (libwww-perl) for almost all actions.
23
24EOT
25    sleep(2);  # Don't hurry too much
26} else {
27    print " ok\n";
28}
29print "Checking for URI...........";
30eval {
31    require URI;
32    URI->VERSION(1.10);
33};
34if ($@) {
35    print " failed\n";
36    $missing_modules++;
37    print <<EOT;
38$@
39The URI module must be installed.  WWW without URIs would not
40be that great :-)
41
42EOT
43    sleep(2);  # Don't hurry too much
44} else {
45    print " ok\n";
46}
47print "Checking for HTML::Parser..";
48eval {
49    require HTML::HeadParser;
50    HTML::Parser->VERSION(3.33);
51};
52if ($@) {
53    print " failed\n";
54    $missing_modules++;
55    print <<EOT;
56$@
57The HTML::Parser is needed to extract correct base URI information from
58HTML so that we can resolve relative links correctly.  The HTML::Form
59module also need HTML::TokeParser to work.
60
61EOT
62    sleep(2);  # Don't hurry too much
63} else {
64    print " ok\n";
65}
66
67print "Checking for MIME::Base64..";
68eval {
69    require MIME::Base64;
70    #MIME::Base64->VERSION('2.00');
71};
72if ($@) {
73    print " failed\n";
74    $missing_modules++;
75    print <<EOT;
76$@
77The Base64 encoding is used in authentication headers in HTTP.
78
79EOT
80    sleep(2);  # Don't hurry too much
81} else {
82    print " ok\n";
83}
84
85print "Checking for Net::FTP......";
86eval {
87    require Net::FTP;
88    Net::FTP->VERSION('2.58');
89};
90if ($@) {
91    print " failed\n";
92    $missing_modules++;
93    print <<EOT;
94$@
95The libwww-perl library normally use the Net::FTP module when
96accessing ftp servers.  You would have to install this package or
97configure your application to use a proxy server for making ftp
98requests work.  Net::FTP is part of the 'libnet' distribution.
99
100EOT
101    sleep(2);  # Don't hurry too much
102} else {
103    print " ok\n";
104}
105
106print "Checking for Digest::MD5 ..";
107eval {
108    require Digest::MD5;
109};
110if ($@) {
111    print " failed\n";
112    $missing_modules++;
113    print <<EOT;
114$@
115The Digest::MD5 library is needed if you want to be able use the
116experimental "Digest Access Authentication" scheme.  Since very few
117servers implement this authentication scheme, you should normally not
118worry too much about this.
119
120EOT
121} else {
122    print " ok\n";
123}
124
125print "Checking for Mail::Send ..";
126eval {
127    require Mail::Send;
128};
129if ($@) {
130    print " failed\n";
131    $missing_modules++;
132    print <<EOT;
133$@ 
134
135Mail::Send is used to allow Checkbot to send email. You currently
136can not use the --mailto option of Checkbot. Mail::Send can be found
137in the MailTools package.
138
139EOT
140} else {
141    print " ok\n";
142}
143
144print "Checking for Time::Duration ..";
145eval {
146    require Time::Duration;
147};
148if ($@) {
149    print " failed\n";
150    $missing_modules++;
151    print <<EOT;
152$@ 
153
154Time::Duration is used to display information on elapsed time in the
155reports. If Time::Duration is not available Checkbot will still work,
156but this information is not printed in the report.
157
158EOT
159} else {
160    print " ok\n";
161}
162
163print "Checking for Net::SSL ..";
164eval {
165    require Net::SSL;
166};
167if ($@) {
168    print " failed\n";
169    $missing_modules++;
170    print <<EOT;
171$@ 
172
173Net::SSL is used to check https links. If Net::SSL is not available
174Checkbot will still work, but it is not possible to check https://
175links. Net::SSL is part of the Crypt::SSLeay package. Note that this
176package in turn depends on the openssl tools.
177
178EOT
179} else {
180    print " ok\n";
181}
182print <<EOT if $missing_modules;
183The missing modules can be obtained from CPAN.  Visit
184<URL:http://www.perl.com/CPAN/> to find a CPAN site near you.
185
186EOT
187
188print "\n";
189
190# Write the Makefile
191WriteMakefile(
192	      NAME   => "checkbot",
193	      EXE_FILES => [ 'checkbot' ],
194	      MAN3PODS => {},
195	      PM => {},
196	      VERSION_FROM => q(checkbot),
197	      dist => {COMPRESS => 'gzip',
198		       SUFFIX => 'gz' },
199);
200
201