Benjamin Trott > Catalyst-Plugin-AtomServer-0.04 > Catalyst::Plugin::AtomServer

Download:
Catalyst-Plugin-AtomServer-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.04   Source  

NAME ^

Catalyst::Plugin::AtomServer - Atom API server for Catalyst applications

SYNOPSIS ^

    use Catalyst qw( AtomServer
                     Authentication
                     Authentication::Credential::Atom
                     Authentication::Store::Minimal
                   );

DESCRIPTION ^

Catalyst::Plugin::AtomServer implements the necessary bits to make it easy to build an Atom API server for any Catalyst-based application.

It implements:

EXAMPLE ^

Below is an example server that implements authentication, dispatching, and views.

    package My::App;
    use strict;

    use Catalyst qw( AtomServer
                     Authentication
                     Authentication::Credential::Atom
                     Authentication::Store::Minimal
                   );
    use My::App::View::XML;
    use XML::Atom::Feed;

    __PACKAGE__->config(
        name => 'MyApp',
        authentication => { users => { foo => { password => 'bar' } } },
    );

    __PACKAGE__->setup;

    sub default : Private {
        my($self, $c) = @_;
        $c->request->is_atom(1);
        my $method = $c->request->method;
        if ($method eq 'GET') {
            $c->forward('get_entries');
        }
    }

    sub get_entries : Private {
        my($self, $c) = @_;

        ## Authenticate the user using WSSE or Basic auth.
        $c->login_atom or die "Unauthenticated";

        my $feed = XML::Atom::Feed->new;
        $feed->title('Blog');
        $c->stash->{xml_atom_object} = $feed;
    }

    sub end : Private {
        my($self, $c) = @_;
        $c->forward('My::App::View::XML');
    }

    package My::App::View::XML;
    use base qw( Catalyst::View::Atom::XML );

SEE ALSO ^

XML::Atom, Catalyst

AUTHOR ^

Six Apart, cpan@sixapart.com

LICENSE ^

Catalyst::Plugin::AtomServer is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR & COPYRIGHT ^

Except where otherwise noted, Catalyst::Plugin::AtomServer is Copyright 2006 Six Apart, cpan@sixapart.com. All rights reserved.

syntax highlighting: