File: autoload.t

package info (click to toggle)
libwww-perl 5.36-1.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 848 kB
  • ctags: 400
  • sloc: perl: 6,366; makefile: 51; sh: 6
file content (30 lines) | stat: -rw-r--r-- 825 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#
# See if autoloading of protocol schemes work
#

print "1..1\n";

require LWP::UserAgent;
# note no LWP::Protocol::file;

# localhost will not work on win32 (when networking is disabled)
$url = $^O eq 'MSWin32' ? 'file:.' : 'file://localhost/';

print "Trying to fetch " . (new URI::URL $url)->local_path . " ...\n";

my $ua = new LWP::UserAgent;    # create a useragent to test

$ua->timeout(30);               # timeout in seconds
#$ua->use_alarm(0);               # don't use alarms
#$ua->use_eval(0);                # don't eval, just die when thing go wrong
				# (easier to read while debugging)

my $request = new HTTP::Request('GET', $url);

my $response = $ua->request($request, undef, undef);
if ($response->is_success) {
    print "ok 1\n";
} else {
    print $response->error_as_HTML;
    print "not ok 1\n";
}