Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add documentation

  • Loading branch information...
commit e684193f7c33b45684d4c6ad64177e5aedcdb92c 1 parent affce58
@zurborg zurborg authored yanick committed
Showing with 48 additions and 0 deletions.
  1. +48 −0 lib/Dancer/Serializer/
48 lib/Dancer/Serializer/
@@ -18,3 +18,51 @@ sub serialize {
sub content_type {'application/javascript'}
+=head1 NAME
+Dancer::Serializer::JSONP - serializer for handling JSONP data
+=head1 SYNOPSIS
+This class is a subclass of L<Dancer::Serializer::JSON> with support for JSONP.
+In order to use this engine, use the template setting:
+ serializer: JSONP
+This can be done in your config.yml file or directly in your app code with the
+B<set> keyword. This serializer will B<not> be used when the serializer is set
+to B<mutable>.
+All configuration options mentioned in L<Dancer::Serializer::JSON> apply here,
+=head1 METHODS
+=head2 serialize
+Serialize a data structure to a JSON structure with surrounding javascript
+callback method. The name of the callback method is obtained from the request
+parameter I<callback>.
+=head2 deserialize
+See L<Dancer::Serializer::JSON#deserialize>.
+=head2 content_type
+Return 'application/javascript'
+=head1 SEE ALSO
+L<Dancer::Plugin::CORS> is a modern alternative to JSONP, but with limited
+browser support. Today, JSONP can be a serious fallback solution when CORS is
+not supported by a browser.
+=head1 AUTHOR
+David Zurborg, C<< <zurborg at> >>
Please sign in to comment.
Something went wrong with that request. Please try again.