This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag 0.07
in repository libdancer-plugin-rest-perl.

commit 725b5d03b7a6f63bba22dc848de12a0720e0e576
Author: Alexis Sukrieh <suk...@sukria.net>
Date:   Sat Apr 3 15:52:44 2010 +0200

    POD
---
 lib/Dancer/Plugin/REST.pm | 88 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)

diff --git a/lib/Dancer/Plugin/REST.pm b/lib/Dancer/Plugin/REST.pm
index 776b4c4..1c2c08c 100644
--- a/lib/Dancer/Plugin/REST.pm
+++ b/lib/Dancer/Plugin/REST.pm
@@ -2,6 +2,9 @@ package Dancer::Plugin::REST;
 use Dancer ':syntax';
 use Dancer::Plugin;
 
+our $AUTHORITY = 'SUKRIA';
+our $VERSION = '0.1';
+
 register prepare_serializer_for_format =>
 sub {
     my $serializers = {
@@ -18,5 +21,90 @@ sub {
     };
 };
 
+register resource =>
+sub {
+    die "TODO";
+};
+
 register_plugin;
 
+1;
+__END__
+=pod
+
+=head1 NAME
+
+Dancer::Plugin::REST - A plugin for writing RESTful apps with Dancer
+
+=head1 SYNOPSYS
+
+    package MyWebService;
+
+    use Dancer;
+    use Dancer::Plugin::REST;
+
+    prepare_serializer_for_format;
+
+    get '/user/:id.:format' => sub { 
+        User->find(params->{id});   
+    };
+
+    # curl http://mywebservice/user/42.json
+    { "id": 42, "name": "John Foo", email: "jhon....@example.com"}
+    
+    # curl http://mywebservice/user/42.yml
+    --
+    id: 42
+    name: "John Foo"
+    email: "jhon....@example.com"
+
+=head1 DESCRIPTION
+
+This plugin helps you write a RESTful webservice with Dancer.
+
+=head1 KEYWORDS
+
+=head2 prepare_serializer_for_format
+
+When this pragam is used a before filter is set by the plugin to automatically
+change the serializer when a format is detected in the URI.
+
+That means that each route you define with a B<:format> token will trigger a
+serializer defintion, if the format is known.
+
+This lets you define all the REST action you like aas regular Dancer route
+handlers, without taking care of the outgoing data format.
+
+=head2 resource
+
+This keyword lets you declare a resource your application will handle.
+
+    resource user => 
+        get    => sub { # return user where id = params->{id}   },
+        create => sub { # create a new user with params->{user} },
+        delete => sub { # delete user where id = params->{id}   },
+        update => sub { # update user with params->{user}       };
+
+    # this defines the following routes:
+    # GET /user/:id
+    # GET /user/:id.:format
+    # POST /user/create
+    # POST /user/create.:format
+    # DELETE /user/:id
+    # DELETE /user/:id.:format
+    # PUT /user/:id
+    # PUT /user/:id.:format
+
+=head1 LICENCE
+
+This module is released under the same terms as Perl itself.
+
+=head1 AUTHORS
+
+This module has been written by Alexis Sukrieh <suk...@sukria.net>.
+
+=head1 SEE ALSO
+
+L<Dancer> L<http://en.wikipedia.org/wiki/Representational_State_Transfer>
+
+=cut

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libdancer-plugin-rest-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to