Switch to different layout
Simon Wistow [Mon, 3 Nov 2008 23:18:05 +0000 (23:18 +0000)]
lib/XML/Feed.pm
lib/XML/Feed/Entry.pm
lib/XML/Feed/Format/Atom.pm [moved from lib/XML/Feed/Atom.pm with 98% similarity]
lib/XML/Feed/Format/RSS.pm [moved from lib/XML/Feed/RSS.pm with 98% similarity]

index 254ccc9..cd1f1e4 100644 (file)
@@ -14,10 +14,10 @@ our $VERSION = '0.23';
 sub new {
     my $class = shift;
     my $format = shift || 'Atom';
-    my $format_class = 'XML::Feed::' . $format;
+    my $format_class = 'XML::Feed::Format::' . $format;
     eval "use $format_class";
     Carp::croak("Unsupported format $format: $@") if $@;
-    my $feed = bless {}, join('::', __PACKAGE__, $format);
+    my $feed = bless {}, join('::', __PACKAGE__, "Format", $format);
     $feed->init_empty(@_) or return $class->error($feed->errstr);
     $feed;
 }
@@ -61,7 +61,7 @@ sub parse {
         $format = $feed->identify_format(\$xml) or return $class->error($feed->errstr);
     }
 
-    my $format_class = join '::', __PACKAGE__, $format;
+    my $format_class = join '::', __PACKAGE__, "Format", $format;
     eval "use $format_class";
     return $class->error("Unsupported format $format: $@") if $@;
     bless $feed, $format_class;
@@ -103,7 +103,7 @@ sub find_feeds {
 sub convert {
     my $feed = shift;
     my($format) = @_;
-    my $new = __PACKAGE__->new($format);
+    my $new = XML::Feed->new($format);
     for my $field (qw( title link description language author copyright modified generator )) {
         my $val = $feed->$field();
         next unless defined $val;
@@ -127,8 +127,8 @@ sub splice {
 sub _convert_entry {
     my $feed   = shift;
     my $entry  = shift;
-    my $feed_format  = ref($feed);   $feed_format  =~ s!^XML::Feed::!!;
-    my $entry_format = ref($entry);  $entry_format =~ s!^XML::Feed::Entry::!!;
+    my $feed_format  = ref($feed);   $feed_format  =~ s!^XML::Feed::Format::!!;
+    my $entry_format = ref($entry);  $entry_format =~ s!^XML::Feed::Entry::Format::!!;
     return $entry if $entry_format eq $feed_format;
     return $entry->convert($feed_format); 
 }
index 4f18399..957b488 100644 (file)
@@ -20,10 +20,10 @@ sub new {
     my $class = shift;
     my($format) = @_;
     $format ||= 'Atom';
-    my $format_class = 'XML::Feed::' . $format;
+    my $format_class = 'XML::Feed::Format::' . $format;
     eval "use $format_class";
     Carp::croak("Unsupported format $format: $@") if $@;
-    my $entry = bless {}, join('::', __PACKAGE__, $format);
+    my $entry = bless {}, join('::', __PACKAGE__, "Format", $format);
     $entry->init_empty or return $class->error($entry->errstr);
     $entry;
 }
similarity index 98%
rename from lib/XML/Feed/Atom.pm
rename to lib/XML/Feed/Format/Atom.pm
index c206dad..4b2f395 100644 (file)
@@ -1,6 +1,6 @@
 # $Id: Atom.pm 1958 2006-08-14 05:31:27Z btrott $
 
-package XML::Feed::Atom;
+package XML::Feed::Format::Atom;
 use strict;
 
 use base qw( XML::Feed );
@@ -127,7 +127,7 @@ sub modified {
 sub entries {
     my @entries;
     for my $entry ($_[0]->{atom}->entries) {
-        push @entries, XML::Feed::Entry::Atom->wrap($entry);
+        push @entries, XML::Feed::Entry::Format::Atom->wrap($entry);
     }
 
     @entries;
@@ -142,7 +142,7 @@ sub add_entry {
 
 sub as_xml { $_[0]->{atom}->as_xml }
 
-package XML::Feed::Entry::Atom;
+package XML::Feed::Entry::Format::Atom;
 use strict;
 
 use base qw( XML::Feed::Entry );
similarity index 98%
rename from lib/XML/Feed/RSS.pm
rename to lib/XML/Feed/Format/RSS.pm
index 933b0b6..3d43c33 100644 (file)
@@ -1,6 +1,6 @@
 # $Id: RSS.pm 1934 2006-04-22 05:13:55Z btrott $
 
-package XML::Feed::RSS;
+package XML::Feed::Format::RSS;
 use strict;
 
 use base qw( XML::Feed );
@@ -133,7 +133,7 @@ sub entries {
     my $rss = $_[0]->{rss};
     my @entries;
     for my $item (@{ $rss->{items} }) {
-        push @entries, XML::Feed::Entry::RSS->wrap($item);
+        push @entries, XML::Feed::Entry::Format::RSS->wrap($item);
     }
     @entries;
 }
@@ -147,7 +147,7 @@ sub add_entry {
 
 sub as_xml { $_[0]->{rss}->as_string }
 
-package XML::Feed::Entry::RSS;
+package XML::Feed::Entry::Format::RSS;
 use strict;
 
 use XML::Feed::Content;