#!perl # simple test script which uses the Perl5 libcurl bindings. $myurl = $ARGV[0] || 'http://dyndns.itex.at/getip'; use WWW::Curl::Easy; print "Perl Version: $]\n"; $mtime = (stat('/system/perl.nlm'))[9] if ($^O eq 'NetWare'); $mtime = (stat('/perl/bin/perl.exe'))[9] if ($^O eq 'MSWin32'); print "Binary Fdate: ",scalar localtime($mtime),"\n"; print "OS Name : $^O\n\n"; printf ("Curl.pm Version: %s\n", $WWW::Curl::VERSION); printf ("Easy.pm Version: %s\n", $WWW::Curl::Easy::VERSION); printf ("libcurl Version: %s\n\n", WWW::Curl::easy::version()); print ("=" x 78 . "\n"); my $curl = new WWW::Curl::Easy; $curl->setopt(CURLOPT_USERAGENT, $curl->version()); $curl->setopt(CURLOPT_URL, $myurl); $curl->perform; my $err = $curl->errbuf; my $info = $curl->getinfo(CURLINFO_HTTP_CODE); print "$info\n"; print ("=" x 78 . "\n"); print "$err\n" if ($err);