1#!/usr/bin/perl -w
2#
3# Here we test the presence of optional modules,
4# needed for some registries in Net::DRI but not all of them,
5# and we warn the user if they are not present
6
7use Test::More tests => 11;
8
9SKIP: {
10	eval { require Net::SMTP; };
11	skip 'Module Net::SMTP is not installed, you need it if you want to use Net::DRI for: AFNIC (emails)',1 if $@;
12	require_ok('Net::DRI::Transport::SMTP');
13}
14
15SKIP: {
16	eval { require MIME::Entity; };
17	skip 'Module MIME::Entity is not installed, you need it if you want to use Net::DRI for: AFNIC (emails)',2 if $@;
18	require_ok('Net::DRI::Protocol::AFNIC::Email::Message');
19	require_ok('Net::DRI::Protocol::AFNIC::Email'); ## depends on Message
20}
21
22SKIP: {
23	eval { require XMLRPC::Lite; };
24	skip 'Module XMLRPC::Lite is not installed, you need it if you want to use Net::DRI for: Gandi (WebServices)',2 if $@;
25	require_ok('Net::DRI::Transport::HTTP::XMLRPCLite');
26        require_ok('Net::DRI::Protocol::Gandi::WS::Connection'); ## depends on XMLRPC::Data
27}
28
29SKIP: {
30	eval { require SOAP::Lite; };
31	skip 'Module SOAP::Lite is not installed, you need it if you want to use Net::DRI for: AFNIC (WebServices), BookMyName (WebServices)',1 if $@;
32	require_ok('Net::DRI::Transport::HTTP::SOAPLite');
33}
34
35SKIP: {
36	eval { require SOAP::WSDL; }; ## also needs SOAP::Lite
37	skip('Module SOAP::WSDL is not installed, you need it if you want to use Net::DRI for: OVH (WebServices)',1) if $@;
38	require_ok('Net::DRI::Transport::HTTP::SOAPWSDL');
39}
40
41SKIP: {
42	eval { require LWP::UserAgent; };
43	skip('Module LWP::UserAgent is not installed, you need it if you want to use Net::DRI for: OpenSRS (XCP), .PL (EPP over HTTPS)',1) if $@;
44	require_ok('Net::DRI::Transport::HTTP');
45}
46
47SKIP: {
48	eval { require HTTP::Request; };
49	skip('Module HTTP::Request is not installed, you need it if you want to use Net::DRI for: .PL (EPP over HTTPS) .IT (EPP over HTTPS)',1) if $@;
50	require_ok('Net::DRI::Protocol::EPP::Extensions::HTTP');
51}
52
53SKIP: {
54	eval { require Digest::MD5; };
55	skip('Module Digest::MD5 is not installed, you need it if you want to use Net::DRI for: OpenSRS (XCP)',1) if $@;
56        eval { require HTTP::Request; };
57        skip('Module HTTP::Request is not installed, you need it if you want to use Net::DRI for: OpenSRS (XCP)',1) if $@;
58	require_ok('Net::DRI::Protocol::OpenSRS::XCP::Connection');
59}
60
61SKIP: {
62	eval { require IO::Uncompress::RawInflate; };
63	skip('Module IO::Uncompress::RawInflate is not installed, you need it if you want to use Net::DRI for: .DE (IRIS DCHK over LWZ)',1) if $@;
64	eval { require Net::DNS; };
65	skip('Module Net::DNS is not installed, you need it if you want to use Net::DRI for: .DE (IRIS DCHK over LWZ)',1) if $@;
66	require_ok('Net::DRI::Protocol::IRIS::LWZ');
67}
68
69exit 0;
70