summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2008-12-19 14:38:14 +0000
committerSteve Hay <SteveHay@planit.com>2008-12-19 14:54:05 +0000
commit6b6e6e926fbaa8fd5416b8b6996454222feffccd (patch)
tree942c9c0f1401be5e19ea90bdc37db269877e520c /lib
parent6421dfaca61871abc4c112c2f1a2b6eaf40f5d11 (diff)
downloadperl-6b6e6e926fbaa8fd5416b8b6996454222feffccd.tar.gz
Subject: [PATCH] Update File::Fetch to 0.18
From: "Jos I. Boumans" <jos@dwim.org> Date: Wed, 17 Dec 2008 14:22:13 +0100 Message-Id: <FCD0E6F5-73C2-4FAE-8EBE-3838741352D4@dwim.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/File/Fetch.pm23
-rw-r--r--lib/File/Fetch/t/01_File-Fetch.t7
2 files changed, 18 insertions, 12 deletions
diff --git a/lib/File/Fetch.pm b/lib/File/Fetch.pm
index 4293fb9950..03bf1475d3 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 af41f987ce..519ca27403 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'};