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;
}
$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;
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;
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);
}
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;
}
# $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 );
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;
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 );
# $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 );
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;
}
sub as_xml { $_[0]->{rss}->as_string }
-package XML::Feed::Entry::RSS;
+package XML::Feed::Entry::Format::RSS;
use strict;
use XML::Feed::Content;