[libdancer-plugin-rest-perl] 02/63: lib/Dancer/Plugin/REST.pm
Jonas Smedegaard
dr at jones.dk
Wed Jul 2 11:44:49 UTC 2014
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 dab5657feb31f9473ee193f9ccbcfa61ebb3d704
Author: Alexis Sukrieh <sukria at sukria.net>
Date: Sat Apr 3 15:26:07 2010 +0200
lib/Dancer/Plugin/REST.pm
---
lib/Dancer/Plugin/REST.pm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/lib/Dancer/Plugin/REST.pm b/lib/Dancer/Plugin/REST.pm
new file mode 100644
index 0000000..776b4c4
--- /dev/null
+++ b/lib/Dancer/Plugin/REST.pm
@@ -0,0 +1,22 @@
+package Dancer::Plugin::REST;
+use Dancer ':syntax';
+use Dancer::Plugin;
+
+register prepare_serializer_for_format =>
+sub {
+ my $serializers = {
+ 'json' => 'JSON',
+ 'yml' => 'YAML',
+ 'xml' => 'XML',
+ 'dump' => 'Dumper',
+ };
+
+ before sub {
+ my $format = params->{'format'};
+ set serializer $serializers->{$format}
+ if $format && $serializers->{$format};
+ };
+};
+
+register_plugin;
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdancer-plugin-rest-perl.git
More information about the Pkg-perl-cvs-commits
mailing list