The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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. entries may also contain a list of XML::Feed::Entry objects, or objects that support a as_feed_entry method which returns XML::Feed::Entry objects or the appropriate hash.

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

METHODS

feed

Arguments: $c, $type

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

Returns an XML::Feed object from the configuration described above.

feed_entries

Arguments: $c, $type

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

Returns a list of XML::Feed::Entry objects from the configuration described above.

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, changing 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/