The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

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

SYNOPSIS

See 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-2023 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.