Bin/../mojo/lib";
use lib "$FindBin::Bin/../../mojo/lib";
}
use Mojolicious::Lite;
use Mojo::JSON;
app->renderer->add_helper(
action => sub {
my ( $self, $action ) = @_;
sta
close $fh;
my $json = Mojo::JSON->new;
my $data = $json->decode($content);
if ( $json->error ) {
die $json->error;
}
_->{$param} )
|| $value ~~ $_->{$param}
} @data;
}
$self->render_json( \@data );
};
app->start;
__DATA__
@@ index.html.ep
% layout 'default';
Please try /api/action,
serAgent;
use URI;
use Net::OAuth;
use JSON;
{
my @attr_refs = \(
my %base_uri_of,
my %ua_of, my %auth_of, my %actions_of,
my %json_of,
);
sub new {
my (
of{$ident} = $options->{ua} || LWP::UserAgent->new();
$json_of{$ident} = $options->{json} || JSON->new();
$actions_of{$ident} = $options->{actions}
||
my $data;
eval {
$data = $json_of{$ident}->decode( $response->decoded_content );
};
croak "Invalid JSON from [$uri]" if $@;
return $data;
}