Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub startup {
- my $self = shift;
- $self->helper(API => sub {
- ...
- if (no error) {
- return { result => { foo => 'bar' } };
- } elsif (error occured) {
- return { error => { foo => 'bar' } };
- }
- });
- my $r = $self->routes;
- $r->get('/')->to('app#main');
- }
- # at app.pm
- sub main {
- my $self = shift;
- my $api = $self->API(args);
- if ($api->{'error'}) {
- $self->render('error/api', %{$self->{'error'}});
- }
- ...
- $self->render('app/main')
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement