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

NAME

MVC::Neaf::View::JS - JSON-based view for Not Even A Framework.

SYNOPSIS

See MVC::Neaf.

    use MVC::Neaf;

    # define route ...
    sub {
        return {
            # your data ...
            -view => 'JS',                 # this is the default as of 0.20
            -jsonp => 'my.jsonp.callback', # this is optional
        }
    };

Will result in your application returning raw data in JSON/JSONP format instead or rendering a template.

METHODS

new( %options )

%options may include:

  • want_pretty - sort keys & indent output

  • want_sorted - sort keys (this defaults to want_pretty)

  • preserve_dash - don't strip dashed options. Useful for debugging.

render( \%data )

Returns a scalar with JSON-encoded data.

LICENSE AND COPYRIGHT

This module is part of MVC::Neaf suite.

Copyright 2016-2018 Konstantin S. Uvarin khedin@cpan.org.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.