Permalink
Browse files

Load XML-Feed-0.08 into trunk.

  • Loading branch information...
1 parent 2310317 commit ecac864aa8679ab8937614deed1f0f6616ced10f @simonwistow simonwistow committed Apr 22, 2008
View
11 Changes
@@ -1,7 +1,16 @@
-# $Id: Changes 1872 2005-08-12 04:28:42Z btrott $
+# $Id: Changes 1924 2006-03-03 17:34:15Z btrott $
Revision history for XML::Feed
+0.08 2006.03.03
+ - $feed->author wasn't being converted properly by Feed->convert. Thanks
+ to Tatsuhiko Miyagawa for the patch.
+ - Added eval around Entry->issued calls, to properly catch invalid
+ date formats, and just return undef, rather than dying. Thanks to
+ Tatsuhiko Miyagawa for the spot.
+ - Fixed issued/modified format issue with dates in timezones other than
+ UTC. Thanks to Tatsuhiko Miyagawa for the patch.
+
0.07 2005.08.11
- Added XML::Feed::splice method, to make feed splicing easier.
- Fixed some unitialized value warnings.
View
@@ -1,6 +1,9 @@
Build.PL
Changes
inc/ExtUtils/AutoInstall.pm
+inc/HTML/TokeParser.pm
+inc/LWP.pm
+inc/Module/AutoInstall.pm
inc/Module/Install.pm
inc/Module/Install/AutoInstall.pm
inc/Module/Install/Base.pm
@@ -26,6 +29,7 @@ t/01-parse.t
t/02-create.t
t/04-splice.t
t/samples/atom.xml
+t/samples/rss10-invalid-date.xml
t/samples/rss10.xml
t/samples/rss20-no-summary.xml
t/samples/rss20.xml
View
@@ -1,24 +1,25 @@
-name: XML-Feed
-version: 0.07
abstract: XML Syndication Feed Support
author: Six Apart <cpan@sixapart.com>
-license: perl
+build_requires:
+ HTML::TokeParser: 0
+ LWP: 0
distribution_type: module
+generated_by: Module::Install version 0.57
+license: perl
+name: XML-Feed
+no_index:
+ directory:
+ - t
+ - inc
+ - t
requires:
Class::ErrorHandler: 0
- Feed::Find: 0
- URI::Fetch: 0
- XML::RSS: 1.01
- XML::Atom: 0.08
- LWP: 0
- HTML::Parser: 0
- URI: 0
DateTime: 0
DateTime::Format::Mail: 0
DateTime::Format::W3CDTF: 0
+ Feed::Find: 0
List::Util: 0
-no_index:
- directory:
- - t
- - inc
-generated_by: Module::Install version 0.36
+ URI::Fetch: 0
+ XML::Atom: 0.08
+ XML::RSS: 1.01
+version: 0.08
View
@@ -1,4 +1,4 @@
-# $Id: Makefile.PL 1869 2005-08-10 00:02:25Z btrott $
+# $Id: Makefile.PL 1925 2006-03-03 17:37:50Z btrott $
use inc::Module::Install;
@@ -17,13 +17,12 @@ requires('Feed::Find');
requires('URI::Fetch');
requires('XML::RSS' => 1.01);
requires('XML::Atom' => 0.08);
-requires('LWP');
-requires('HTML::Parser');
-requires('URI');
requires('DateTime');
requires('DateTime::Format::Mail');
requires('DateTime::Format::W3CDTF');
requires('List::Util');
+build_requires('LWP');
+build_requires('HTML::TokeParser');
auto_include();
auto_install();
View
5 README
@@ -1,4 +1,4 @@
-$Id: README 1869 2005-08-10 00:02:25Z btrott $
+$Id: README 1925 2006-03-03 17:37:50Z btrott $
This is XML::Feed, an abstraction above the RSS and Atom syndication
feed formats. It supports both parsing and autodiscovery of feeds.
@@ -8,9 +8,6 @@ PREREQUISITES
* Class::ErrorHandler
* XML::RSS
* XML::Atom
- * LWP
- * HTML::Parser
- * URI
* DateTime
* DateTime::Format::Mail
* DateTime::Format::W3CDTF
@@ -9,7 +9,7 @@ use strict;
use Cwd ();
use ExtUtils::MakeMaker ();
-#line 282
+#line 281
# special map on pre-defined feature sets
my %FeatureMap = (
@@ -628,4 +628,4 @@ installdeps ::
__END__
-#line 929
+#line 928
View
@@ -0,0 +1,155 @@
+#line 1 "inc/HTML/TokeParser.pm - /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level/HTML/TokeParser.pm"
+package HTML::TokeParser;
+
+# $Id: TokeParser.pm,v 2.28 2003/10/14 10:11:05 gisle Exp $
+
+require HTML::PullParser;
+@ISA=qw(HTML::PullParser);
+$VERSION = sprintf("%d.%02d", q$Revision: 2.28 $ =~ /(\d+)\.(\d+)/);
+
+use strict;
+use Carp ();
+use HTML::Entities qw(decode_entities);
+use HTML::Tagset ();
+
+my %ARGS =
+(
+ start => "'S',tagname,attr,attrseq,text",
+ end => "'E',tagname,text",
+ text => "'T',text,is_cdata",
+ process => "'PI',token0,text",
+ comment => "'C',text",
+ declaration => "'D',text",
+);
+
+
+sub new
+{
+ my $class = shift;
+ my %cnf;
+ if (@_ == 1) {
+ my $type = (ref($_[0]) eq "SCALAR") ? "doc" : "file";
+ %cnf = ($type => $_[0]);
+ }
+ else {
+ %cnf = @_;
+ }
+
+ my $textify = delete $cnf{textify} || {img => "alt", applet => "alt"};
+
+ my $self = $class->SUPER::new(%cnf, %ARGS) || return undef;
+
+ $self->{textify} = $textify;
+ $self;
+}
+
+
+sub get_tag
+{
+ my $self = shift;
+ my $token;
+ while (1) {
+ $token = $self->get_token || return undef;
+ my $type = shift @$token;
+ next unless $type eq "S" || $type eq "E";
+ substr($token->[0], 0, 0) = "/" if $type eq "E";
+ return $token unless @_;
+ for (@_) {
+ return $token if $token->[0] eq $_;
+ }
+ }
+}
+
+
+sub _textify {
+ my($self, $token) = @_;
+ my $tag = $token->[1];
+ return undef unless exists $self->{textify}{$tag};
+
+ my $alt = $self->{textify}{$tag};
+ my $text;
+ if (ref($alt)) {
+ $text = &$alt(@$token);
+ } else {
+ $text = $token->[2]{$alt || "alt"};
+ $text = "[\U$tag]" unless defined $text;
+ }
+ return $text;
+}
+
+
+sub get_text
+{
+ my $self = shift;
+ my @text;
+ while (my $token = $self->get_token) {
+ my $type = $token->[0];
+ if ($type eq "T") {
+ my $text = $token->[1];
+ decode_entities($text) unless $token->[2];
+ push(@text, $text);
+ } elsif ($type =~ /^[SE]$/) {
+ my $tag = $token->[1];
+ if ($type eq "S") {
+ if (defined(my $text = _textify($self, $token))) {
+ push(@text, $text);
+ next;
+ }
+ } else {
+ $tag = "/$tag";
+ }
+ if (!@_ || grep $_ eq $tag, @_) {
+ $self->unget_token($token);
+ last;
+ }
+ push(@text, " ")
+ if $tag eq "br" || !$HTML::Tagset::isPhraseMarkup{$token->[1]};
+ }
+ }
+ join("", @text);
+}
+
+
+sub get_trimmed_text
+{
+ my $self = shift;
+ my $text = $self->get_text(@_);
+ $text =~ s/^\s+//; $text =~ s/\s+$//; $text =~ s/\s+/ /g;
+ $text;
+}
+
+sub get_phrase {
+ my $self = shift;
+ my @text;
+ while (my $token = $self->get_token) {
+ my $type = $token->[0];
+ if ($type eq "T") {
+ my $text = $token->[1];
+ decode_entities($text) unless $token->[2];
+ push(@text, $text);
+ } elsif ($type =~ /^[SE]$/) {
+ my $tag = $token->[1];
+ if ($type eq "S") {
+ if (defined(my $text = _textify($self, $token))) {
+ push(@text, $text);
+ next;
+ }
+ }
+ if (!$HTML::Tagset::isPhraseMarkup{$tag}) {
+ $self->unget_token($token);
+ last;
+ }
+ push(@text, " ") if $tag eq "br";
+ }
+ }
+ my $text = join("", @text);
+ $text =~ s/^\s+//; $text =~ s/\s+$//; $text =~ s/\s+/ /g;
+ $text;
+}
+
+1;
+
+
+__END__
+
+#line 341
View
@@ -0,0 +1,17 @@
+#line 1 "inc/LWP.pm - /Library/Perl/5.8.6/LWP.pm"
+#
+# $Id: LWP.pm,v 1.149 2005/12/08 12:06:22 gisle Exp $
+
+package LWP;
+
+$VERSION = "5.805";
+sub Version { $VERSION; }
+
+require 5.005;
+require LWP::UserAgent; # this should load everything you need
+
+1;
+
+__END__
+
+#line 658
Oops, something went wrong.

0 comments on commit ecac864

Please sign in to comment.