use warnings; use strict; use Test::More tests => 5; BEGIN { use_ok "Net::HTTP::Tiny", qw(http_get); } eval { http_get("http://www.funet.fi/pub/CPAN/indices/_does_not_exist_") }; my $file = __FILE__; my $line = __LINE__-1; like $@, qr/\AHTTP error: 404 [ -~]* at \Q$file\E line \Q$line\E\.?\n\z/; my $ts = eval { http_get("http://www.funet.fi/pub/CPAN/indices/timestamp.txt") }; is $@, ""; ok defined($ts) && ref($ts) eq ""; like $ts, qr/\A[0-9]{10,} [ -~]*\n\z/; 1;