Skip to content

Commit

Permalink
Load XML-Feed-0.03 into trunk.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwistow committed Apr 22, 2008
1 parent a749d9b commit 62d9277
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 82 deletions.
12 changes: 10 additions & 2 deletions 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
Expand Down
1 change: 0 additions & 1 deletion MANIFEST
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions 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
Expand All @@ -18,4 +20,4 @@ no_index:
directory:
- t
- inc
generated_by: Module::Install version 0.33
generated_by: Module::Install version 0.35
4 changes: 3 additions & 1 deletion 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;

Expand All @@ -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');
Expand Down
4 changes: 3 additions & 1 deletion 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
Expand All @@ -14,6 +15,7 @@ PREREQUISITES
* DateTime::Format::Mail
* DateTime::Format::W3CDTF
* List::Util
* Feed::Find

INSTALLATION

Expand Down
21 changes: 11 additions & 10 deletions 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:
Expand All @@ -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;
Expand All @@ -46,7 +47,7 @@ sub import {
delete $INC{"$self->{path}.pm"};
}

#line 156
#line 159

sub autoload {
my $self = shift;
Expand All @@ -66,7 +67,7 @@ sub autoload {
};
}

#line 181
#line 184

sub new {
my ($class, %args) = @_;
Expand All @@ -91,7 +92,7 @@ sub new {
bless(\%args, $class);
}

#line 210
#line 213

sub call {
my $self = shift;
Expand All @@ -102,7 +103,7 @@ sub call {
goto &{$obj->can($method)};
}

#line 225
#line 228

sub load {
my ($self, $method) = @_;
Expand All @@ -126,7 +127,7 @@ END
$obj;
}

#line 255
#line 258

sub load_extensions {
my ($self, $path, $top_obj) = @_;
Expand All @@ -145,7 +146,7 @@ sub load_extensions {
}
}

#line 279
#line 282

sub find_extensions {
my ($self, $path) = @_;
Expand All @@ -168,4 +169,4 @@ sub find_extensions {

__END__
#line 614
#line 620
3 changes: 2 additions & 1 deletion inc/Module/Install/Include.pm
@@ -1,12 +1,13 @@
#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);

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;
51 changes: 9 additions & 42 deletions 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;
Expand Down Expand Up @@ -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/^.*://;
Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions 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;
Expand Down
20 changes: 0 additions & 20 deletions lib/XML/Feed/ErrorHandler.pm

This file was deleted.

0 comments on commit 62d9277

Please sign in to comment.