-# $Id: Entry.pm 1865 2005-08-09 20:15:31Z btrott $
+# $Id: Entry.pm 1872 2005-08-12 04:28:42Z btrott $
package XML::Feed::Entry;
use strict;
use base qw( Class::ErrorHandler );
+use Scalar::Util qw( blessed );
+
use Carp;
sub wrap {
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;
}
my $entry = shift;
my($format) = @_;
my $new = __PACKAGE__->new($format);
- for my $field (qw( title link content summary category author id issued modified )) {
- $new->$field($entry->$field());
+ 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;
}
sub id;
sub issued;
sub modified;
+sub lat;
+sub long;
1;
__END__
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
If present, I<$modified> should be a I<DateTime> object.
+=head2 $entry->wrap
+
+Take an entry in its native format and turn it into an I<XML::Feed::Entry> object.
+
+=head2 $entry->unwrap
+
+Take an I<XML::Feed::Entry> object and turn it into its native format.
+
=head1 AUTHOR & COPYRIGHT
Please see the I<XML::Feed> manpage for author, copyright, and license