Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Load XML-Feed-0.03 into trunk.

  • Loading branch information...
commit 62d927717343b9ff19c9fccd5b0318adeeceb5ce 1 parent a749d9b
@simonwistow simonwistow authored
View
12 Changes
@@ -1,8 +1,16 @@
-# $Id: Changes,v 1.4 2004/07/29 16:42:29 btrott Exp $
+# $Id: Changes,v 1.7 2004/10/09 07:02:01 btrott Exp $
Revision history for XML::Feed
-0.02
+0.03 2004.10.09
+ - Fixed bug with feed format detection: properly detect format even in
+ feeds with <!DOCTYPE> at the top. (Thanks to Alberto Quario for the
+ note.)
+ - Use Class::ErrorHandler instead of XML::Feed::ErrorHandler.
+ - Moved auto-discovery code into Feed::Find. XML::Feed->find_feeds is
+ now just a wrapper around that module.
+
+0.02 2004.07.29
- Changed behavior of Entry->summary to prevent it from returning the
full contents of the entry. Now, in an RSS feed, summary only returns
a value if there is both a <description> element *and* one of the
View
1  MANIFEST
@@ -16,7 +16,6 @@ lib/XML/Feed.pm
lib/XML/Feed/Atom.pm
lib/XML/Feed/Content.pm
lib/XML/Feed/Entry.pm
-lib/XML/Feed/ErrorHandler.pm
lib/XML/Feed/RSS.pm
Makefile.PL
MANIFEST This list of files
View
6 META.yml
@@ -1,10 +1,12 @@
name: XML-Feed
-version: 0.02
+version: 0.03
abstract: XML Syndication Feed Support
author: Benjamin Trott <cpan@stupidfool.org>
license: perl
distribution_type: module
requires:
+ Class::ErrorHandler: 0
+ Feed::Find: 0
XML::RSS: 1.01
XML::Atom: 0.08
LWP: 0
@@ -18,4 +20,4 @@ no_index:
directory:
- t
- inc
-generated_by: Module::Install version 0.33
+generated_by: Module::Install version 0.35
View
4 Makefile.PL
@@ -1,4 +1,4 @@
-# $Id: Makefile.PL,v 1.1.1.1 2004/05/29 17:29:56 btrott Exp $
+# $Id: Makefile.PL,v 1.2 2004/10/04 03:38:11 btrott Exp $
use inc::Module::Install;
@@ -12,6 +12,8 @@ sign(1);
include('ExtUtils::AutoInstall');
+requires('Class::ErrorHandler');
+requires('Feed::Find');
requires('XML::RSS' => 1.01);
requires('XML::Atom' => 0.08);
requires('LWP');
View
4 README
@@ -1,10 +1,11 @@
-$Id: README,v 1.1.1.1 2004/05/29 17:29:56 btrott Exp $
+$Id: README,v 1.2 2004/10/09 07:06:11 btrott Exp $
This is XML::Feed, an abstraction above the RSS and Atom syndication
feed formats. It supports both parsing and autodiscovery of feeds.
PREREQUISITES
+ * Class::ErrorHandler
* XML::RSS
* XML::Atom
* LWP
@@ -14,6 +15,7 @@ PREREQUISITES
* DateTime::Format::Mail
* DateTime::Format::W3CDTF
* List::Util
+ * Feed::Find
INSTALLATION
View
21 inc/Module/Install.pm
@@ -1,9 +1,9 @@
#line 1 "inc/Module/Install.pm - /Library/Perl/5.8.1/Module/Install.pm"
# $File: //depot/cpan/Module-Install/lib/Module/Install.pm $ $Author: autrijus $
-# $Revision: #67 $ $Change: 1885 $ $DateTime: 2004/03/11 05:55:27 $ vim: expandtab shiftwidth=4
+# $Revision: #69 $ $Change: 2301 $ $DateTime: 2004/07/13 07:16:40 $ vim: expandtab shiftwidth=4
package Module::Install;
-$VERSION = '0.33';
+$VERSION = '0.35';
die << "." unless $INC{join('/', inc => split(/::/, __PACKAGE__)).'.pm'};
Please invoke ${\__PACKAGE__} with:
@@ -22,8 +22,9 @@ use File::Find ();
use File::Path ();
@inc::Module::Install::ISA = 'Module::Install';
+*inc::Module::Install::VERSION = *VERSION;
-#line 129
+#line 132
sub import {
my $class = shift;
@@ -46,7 +47,7 @@ sub import {
delete $INC{"$self->{path}.pm"};
}
-#line 156
+#line 159
sub autoload {
my $self = shift;
@@ -66,7 +67,7 @@ sub autoload {
};
}
-#line 181
+#line 184
sub new {
my ($class, %args) = @_;
@@ -91,7 +92,7 @@ sub new {
bless(\%args, $class);
}
-#line 210
+#line 213
sub call {
my $self = shift;
@@ -102,7 +103,7 @@ sub call {
goto &{$obj->can($method)};
}
-#line 225
+#line 228
sub load {
my ($self, $method) = @_;
@@ -126,7 +127,7 @@ END
$obj;
}
-#line 255
+#line 258
sub load_extensions {
my ($self, $path, $top_obj) = @_;
@@ -145,7 +146,7 @@ sub load_extensions {
}
}
-#line 279
+#line 282
sub find_extensions {
my ($self, $path) = @_;
@@ -168,4 +169,4 @@ sub find_extensions {
__END__
-#line 614
+#line 620
View
3  inc/Module/Install/Include.pm
@@ -1,6 +1,6 @@
#line 1 "inc/Module/Install/Include.pm - /Library/Perl/5.8.1/Module/Install/Include.pm"
# $File: //depot/cpan/Module-Install/lib/Module/Install/Include.pm $ $Author: autrijus $
-# $Revision: #8 $ $Change: 1811 $ $DateTime: 2003/12/14 18:52:33 $ vim: expandtab shiftwidth=4
+# $Revision: #9 $ $Change: 2288 $ $DateTime: 2004/07/01 04:49:12 $ vim: expandtab shiftwidth=4
package Module::Install::Include;
use Module::Install::Base; @ISA = qw(Module::Install::Base);
@@ -8,5 +8,6 @@ use Module::Install::Base; @ISA = qw(Module::Install::Base);
sub include { +shift->admin->include(@_) };
sub include_deps { +shift->admin->include_deps(@_) };
sub auto_include { +shift->admin->auto_include(@_) };
+sub auto_include_deps { +shift->admin->auto_include_deps(@_) };
1;
View
51 lib/XML/Feed.pm
@@ -1,22 +1,15 @@
-# $Id: Feed.pm,v 1.8 2004/07/29 16:44:18 btrott Exp $
+# $Id: Feed.pm,v 1.10 2004/10/09 07:05:08 btrott Exp $
package XML::Feed;
use strict;
-use base qw( XML::Feed::ErrorHandler );
+use base qw( Class::ErrorHandler );
use LWP::UserAgent;
use HTML::Parser;
+use Feed::Find;
use vars qw( $VERSION );
-$VERSION = '0.02';
-
-use constant FEED_MIME_TYPES => [
- 'application/x.atom+xml',
- 'application/atom+xml',
- 'text/xml',
- 'application/rss+xml',
- 'application/rdf+xml',
-];
+$VERSION = '0.03';
sub parse {
my $class = shift;
@@ -52,8 +45,9 @@ sub parse {
## feed ourselves.
my $tag;
while ($xml =~ /<(\S+)/sg) {
- (my $t = $1) =~ tr/a-zA-Z0-9:\-\?//cd;
- $tag = $t, last unless substr($t, 0, 1) eq '?';
+ (my $t = $1) =~ tr/a-zA-Z0-9:\-\?!//cd;
+ my $first = substr $t, 0, 1;
+ $tag = $t, last unless $first eq '?' || $first eq '!';
}
return $class->error("Cannot find first element") unless $tag;
$tag =~ s/^.*://;
@@ -73,35 +67,8 @@ sub parse {
sub find_feeds {
my $class = shift;
my($uri) = @_;
- my $ua = LWP::UserAgent->new;
- my $req = HTTP::Request->new(GET => $uri);
- my $res = $ua->request($req);
- return unless $res->is_success;
- my @feeds;
- my %is_feed = map { $_ => 1 } @{ FEED_MIME_TYPES() };
- my $ct = $res->content_type;
- if ($is_feed{$ct}) {
- @feeds = ($uri);
- } elsif ($ct eq 'text/html' || $ct eq 'application/xhtml+xml') {
- my $base_uri = $uri;
- my $find_links = sub {
- my($tag, $attr) = @_;
- if ($tag eq 'link') {
- return unless $attr->{rel};
- my %rel = map { $_ => 1 } split /\s+/, lc($attr->{rel});
- (my $type = lc $attr->{type}) =~ s/^\s*//;
- $type =~ s/\s*$//;
- push @feeds, URI->new_abs($attr->{href}, $base_uri)->as_string
- if $is_feed{$type} &&
- ($rel{alternate} || $rel{'service.feed'});
- } elsif ($tag eq 'base') {
- $base_uri = $attr->{href};
- }
- };
- my $p = HTML::Parser->new(api_version => 3,
- start_h => [ $find_links, "tagname, attr" ]);
- $p->parse($res->content);
- }
+ my @feeds = Feed::Find->find($uri)
+ or return $class->error(Feed::Find->errstr);
@feeds;
}
View
4 lib/XML/Feed/Content.pm
@@ -1,9 +1,9 @@
-# $Id: Content.pm,v 1.1 2004/06/20 15:20:38 btrott Exp $
+# $Id: Content.pm,v 1.2 2004/10/04 03:38:11 btrott Exp $
package XML::Feed::Content;
use strict;
-use base qw( XML::Feed::ErrorHandler );
+use base qw( Class::ErrorHandler );
sub wrap {
my $class = shift;
View
20 lib/XML/Feed/ErrorHandler.pm
@@ -1,20 +0,0 @@
-# $Id: ErrorHandler.pm,v 1.2 2004/05/29 18:19:50 btrott Exp $
-
-package XML::Feed::ErrorHandler;
-use strict;
-
-use vars qw( $ERROR );
-
-sub error {
- my $msg = $_[1] || '';
- $msg .= "\n" unless $msg =~ /\n$/;
- if (ref($_[0])) {
- $_[0]->{_errstr} = $msg;
- } else {
- $ERROR = $msg;
- }
- return;
- }
-sub errstr { ref($_[0]) ? $_[0]->{_errstr} : $ERROR }
-
-1;
Please sign in to comment.
Something went wrong with that request. Please try again.