Group
Extension

Matches 2

Mojolicious-Plugin-REST ( Z/ZI/ZITSEN/Mojolicious-Plugin-REST-0.006.tar.gz, ZITSEN, 2015; MetaCPAN )
Mojolicious-Plugin-REST/lib/Mojolicious/Plugin/REST.pm ( view source; MetaCPAN )
         my $json = $c->stash('json');
                    unless ( defined $json->{data} ) {
                        $json->{data} = {};
                        $c->stash( 'json' => $json );
        
=head1 MOJOLICIOUS HOOKS

This module installs an before_render application hook, which gurantees JSON output.

Refer L<Mojolicious::Controller::REST> documentation for output format.

Hook installati
Mojolicious-Plugin-REST ( Z/ZI/ZITSEN/Mojolicious-Plugin-REST-0.006.tar.gz, ZITSEN, 2015; MetaCPAN )
Mojolicious-Plugin-REST/lib/Mojolicious/Controller/REST.pm ( view source; MetaCPAN )
y %data = @_;

    my $json = $self->stash('json');

    if ( defined( $json->{data} ) ) {
        @{ $json->{data} }{ keys %data } = values %data;
    }
    else {
        $json->{data} = {%data};
  
json => $json );
    return $self;
}

sub message {
    my $self = shift;
    my ( $message, $severity ) = @_;

    $severity //= 'info';

    my $json = $self->stash('json');

    if ( defined( $json
$json->{messages}}, { text => $message, severity => $severity } );
    }
    else {
        $json->{messages} = [ { text => $message, severity => $severity } ];
    }

    $self->stash( json => $json 

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.