summaryrefslogtreecommitdiff
path: root/cpan
diff options
context:
space:
mode:
authorChris Williams <chris@bingosnet.co.uk>2010-01-13 13:30:52 +0000
committerChris Williams <chris@bingosnet.co.uk>2010-01-13 13:30:52 +0000
commit16610ad906328dde8c0ce186f28478759b0d03ba (patch)
treeebab96c5ff4dc164b95ddba28a062486a6d85c22 /cpan
parent73afaec9a8c17d03643a56b3842448c172a26285 (diff)
downloadperl-16610ad906328dde8c0ce186f28478759b0d03ba.tar.gz
Update File-Fetch to CPAN version 0.24
Changes for 0.24 Wed Jan 6 23:32:19 2010 ================================================= * Applied a patch from brian d foy RT #53427 that makes new() respect sub-classes.
Diffstat (limited to 'cpan')
-rw-r--r--cpan/File-Fetch/lib/File/Fetch.pm10
-rw-r--r--cpan/File-Fetch/t/null_subclass.t23
2 files changed, 28 insertions, 5 deletions
diff --git a/cpan/File-Fetch/lib/File/Fetch.pm b/cpan/File-Fetch/lib/File/Fetch.pm
index d90232f413..4aabc29be5 100644
--- a/cpan/File-Fetch/lib/File/Fetch.pm
+++ b/cpan/File-Fetch/lib/File/Fetch.pm
@@ -22,7 +22,7 @@ use vars qw[ $VERBOSE $PREFER_BIN $FROM_EMAIL $USER_AGENT
$FTP_PASSIVE $TIMEOUT $DEBUG $WARN
];
-$VERSION = '0.22';
+$VERSION = '0.24';
$VERSION = eval $VERSION; # avoid warnings with development releases
$PREFER_BIN = 0; # XXX TODO implement
$FROM_EMAIL = 'File-Fetch@example.com';
@@ -178,13 +178,13 @@ result of $ff->output_file will be used.
bless $args, $class;
if( lc($args->scheme) ne 'file' and not $args->host ) {
- return File::Fetch->_error(loc(
+ return $class->_error(loc(
"Hostname required when fetching from '%1'",$args->scheme));
}
for (qw[path file]) {
unless( $args->$_() ) { # 5.5.x needs the ()
- return File::Fetch->_error(loc("No '%1' specified",$_));
+ return $class->_error(loc("No '%1' specified",$_));
}
}
@@ -275,10 +275,10 @@ sub new {
check( $tmpl, \%hash ) or return;
### parse the uri to usable parts ###
- my $href = __PACKAGE__->_parse_uri( $uri ) or return;
+ my $href = $class->_parse_uri( $uri ) or return;
### make it into a FFI object ###
- my $ff = File::Fetch->_create( %$href ) or return;
+ my $ff = $class->_create( %$href ) or return;
### return the object ###
diff --git a/cpan/File-Fetch/t/null_subclass.t b/cpan/File-Fetch/t/null_subclass.t
new file mode 100644
index 0000000000..630a6073c9
--- /dev/null
+++ b/cpan/File-Fetch/t/null_subclass.t
@@ -0,0 +1,23 @@
+use strict;
+use warnings;
+
+use Test::More tests => 5;
+
+my $parent_class = 'File::Fetch';
+my $child_class = 'File::Fetch::Subclass';
+
+use_ok( $parent_class );
+
+my $ff_parent = $parent_class->new( uri => 'http://example.com/index.html' );
+isa_ok( $ff_parent, $parent_class );
+
+can_ok( $child_class, qw( new fetch ) );
+my $ff_child = $child_class->new( uri => 'http://example.com/index.html' );
+isa_ok( $ff_child, $child_class );
+isa_ok( $ff_child, $parent_class );
+
+BEGIN {
+ package File::Fetch::Subclass;
+ use vars qw(@ISA);
+ unshift @ISA, qw(File::Fetch);
+ }