NAME

Mango::Catalyst::View::Feed - View class for XML::Feed based feeds

SYNOPSIS

    $c->view('Atom');
    $c->view('RSS');

DESCRIPTION

Mango::Catalyst::View::Feed renders a feed using XML::Feed and serves it with the appropriate content type.

There is no real reason to use this view directly. Please use Mango::Catalyst::View::RSS or Mango::Catalyst::View::Atom instead.

FEED DATA

When this view is called, it will create a feed using the data in:

    $c->stash->{'entity'};

If entity is a hash, each key will be assigned to the XML::Feed object:

    $c->stash->{'entity'} = {
        title => 'My Feed',
        description => 'This is my feed'
        entries => [
            {title => 'Entry1', id => 1, ...},
            {title => 'Entry2', id => 2, ...}
        ]
    };

    my $feed = XML::Feed->new;
    my $entity = $c->stash->{'entity'};
    $feed->$_($entity->{$_}) for keys %{$entity}

If an entries key is supplied, each item in it will also be converted to an XML::Feed::Entry object and added to the feed.

If entity is an object and it supports the as_feed method, the output from that will be used. as_feed must return a XML::Feed object or the same entity hash described above.

METHODS

process

Arguments: $c, $type

type can be either 'RSS' or 'Atom'.

Creates an XML::Feed of the specific type, writes it to the response body, and changes the content type.

SEE ALSO

Mango::Catalyst::View::RSS, Mango::Catalyst::View::Atom

AUTHOR

    Christopher H. Laco
    CPAN ID: CLACO
    claco@chrislaco.com
    http://today.icantfocus.com/blog/