sub end : Private {
my ( $self, $c ) = @_;
my @posts = $c->model('DBIC::Post')->get_recent_posts(20);
my $feed = XML::Feed->new($c->stash->{type});
$feed->title("Emo Sluts Porn Feed");
$feed->link($c->uri_for('/'));
$feed->self_link('/');
$feed->description("Watch the hottest emo whores and sluts in porn
+ at EmoWomen.com - New emo pussy and ass posted daily.");
$feed->author("Keagan");
$feed->language('en-US');
foreach my $post (@posts) {
my $entry = XML::Feed::Entry->new($c->stash->{type});
my $slug = $post->title;
$slug =~ s/-/ /g;
$entry->link($c->uri_for('/gallery/'.$slug));
$entry->title($post->title);
$entry->content($post->body);
$entry->issued($post->date->epoch);
$entry->modified($post->date->epoch);
my $url_part = $post->title;
$url_part =~ s/ /-/g;
$entry->link($c->req->base.'gallery/'.$url_part);
$feed->add_entry($entry);
}
my $mime = ("Atom" eq $feed->format) ? "application/atom+xml" : "a
+pplication/rss+xml";
$c->res->content_type($mime);
$c->res->body($feed->as_xml);
}
Caught exception in MediaBlogger::Controller::Feeds->end "Can't call m
+ethod "year" without a package or object reference at /usr/local/shar
+e/perl/5.10.1/DateTime/Format/W3CDTF.pm line 79."
Error occurs from this:
$entry->issued($post->date->epoch);
$entry->modified($post->date->epoch);
I'm pretty confused at why the above gives me the error it does. I can call post.date.epoch fine from a TT Template:
[% post.date.epoch %]
Any pointers?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.