From: Steve Hay Date: Fri, 19 Dec 2008 14:38:14 +0000 (+0000) Subject: Subject: [PATCH] Update File::Fetch to 0.18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6b6e6e926fbaa8fd5416b8b6996454222feffccd;p=p5sagit%2Fp5-mst-13.2.git Subject: [PATCH] Update File::Fetch to 0.18 From: "Jos I. Boumans" Date: Wed, 17 Dec 2008 14:22:13 +0100 Message-Id: --- diff --git a/lib/File/Fetch.pm b/lib/File/Fetch.pm index 4293fb9..03bf147 100644 --- a/lib/File/Fetch.pm +++ b/lib/File/Fetch.pm @@ -10,7 +10,7 @@ use File::Basename qw[dirname]; use Cwd qw[cwd]; use Carp qw[carp]; -use IPC::Cmd qw[can_run run]; +use IPC::Cmd qw[can_run run QUOTE]; use File::Path qw[mkpath]; use Params::Check qw[check]; use Module::Load::Conditional qw[can_load]; @@ -21,14 +21,11 @@ use vars qw[ $VERBOSE $PREFER_BIN $FROM_EMAIL $USER_AGENT $FTP_PASSIVE $TIMEOUT $DEBUG $WARN ]; -use constant QUOTE => do { $^O eq 'MSWin32' ? q["] : q['] }; - - -$VERSION = '0.16'; +$VERSION = '0.18'; $VERSION = eval $VERSION; # avoid warnings with development releases $PREFER_BIN = 0; # XXX TODO implement $FROM_EMAIL = 'File-Fetch@example.com'; -$USER_AGENT = 'File::Fetch/$VERSION'; +$USER_AGENT = "File::Fetch/$VERSION"; $BLACKLIST = [qw|ftp|]; $METHOD_FAIL = { }; $FTP_PASSIVE = 1; @@ -51,11 +48,13 @@ local $Module::Load::Conditional::VERBOSE = 0; local $Module::Load::Conditional::VERBOSE = 0; ### see what OS we are on, important for file:// uris ### -use constant ON_WIN => ($^O eq 'MSWin32'); -use constant ON_VMS => ($^O eq 'VMS'); -use constant ON_UNIX => (!ON_WIN); -use constant HAS_VOL => (ON_WIN); -use constant HAS_SHARE => (ON_WIN); +use constant ON_WIN => ($^O eq 'MSWin32'); +use constant ON_VMS => ($^O eq 'VMS'); +use constant ON_UNIX => (!ON_WIN); +use constant HAS_VOL => (ON_WIN); +use constant HAS_SHARE => (ON_WIN); + + =pod =head1 NAME @@ -147,7 +146,7 @@ result of $ff->output_file will be used. ########################## { - ### template for new() and autogenerated accessors ### + ### template for autogenerated accessors ### my $Tmpl = { scheme => { default => 'http' }, host => { default => 'localhost' }, diff --git a/lib/File/Fetch/t/01_File-Fetch.t b/lib/File/Fetch/t/01_File-Fetch.t index af41f98..519ca27 100644 --- a/lib/File/Fetch/t/01_File-Fetch.t +++ b/lib/File/Fetch/t/01_File-Fetch.t @@ -115,6 +115,13 @@ push @map, ( ) if &File::Fetch::ON_WIN; +### sanity tests +{ like( $File::Fetch::USER_AGENT, qr/$File::Fetch::VERSION/, + "User agent contains version" ); + like( $File::Fetch::FROM_EMAIL, qr/@/, + q[Email contains '@'] ); +} + ### parse uri tests ### for my $entry (@map ) { my $uri = $entry->{'uri'};