X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FXML%2FFeed%2FEntry.pm;h=957b4883af1afdccd6ab878c194e24ba17b8af2e;hb=4ad13011b5d49c3a2f38cbf9e625208d627be405;hp=68c377c7786a51f039961b2a55b06eaf9da2a3c5;hpb=23103173b588d98a69b6b3d217dc9c9a47910b02;p=catagits%2FXML-Feed.git diff --git a/lib/XML/Feed/Entry.pm b/lib/XML/Feed/Entry.pm index 68c377c..957b488 100644 --- a/lib/XML/Feed/Entry.pm +++ b/lib/XML/Feed/Entry.pm @@ -4,6 +4,8 @@ package XML::Feed::Entry; use strict; use base qw( Class::ErrorHandler ); +use Scalar::Util qw( blessed ); + use Carp; sub wrap { @@ -18,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; } @@ -32,9 +34,10 @@ sub convert { my $entry = shift; my($format) = @_; my $new = __PACKAGE__->new($format); - for my $field (qw( title link content summary category author id issued modified )) { + for my $field (qw( title link content summary category author id issued modified lat long )) { my $val = $entry->$field(); next unless defined $val; + next if blessed $val && $val->isa('XML::Feed::Content') && ! defined $val->body; $new->$field($val); } $new; @@ -49,6 +52,8 @@ sub author; sub id; sub issued; sub modified; +sub lat; +sub long; 1; __END__ @@ -85,6 +90,10 @@ returns the new object. The title of the entry. +=head2 $entry->base([ $base ]) + +The url base of the entry. + =head2 $entry->link([ $uri ]) The permalink of the entry, in most cases, except in cases where it points @@ -138,6 +147,14 @@ A I object representing the last-modified date of the entry. If present, I<$modified> should be a I object. +=head2 $entry->wrap + +Take an entry in its native format and turn it into an I object. + +=head2 $entry->unwrap + +Take an I object and turn it into its native format. + =head1 AUTHOR & COPYRIGHT Please see the I manpage for author, copyright, and license