Guest User

Untitled

a guest
May 26th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use common::sense;
  3. use lib qw(../lib lib);
  4.  
  5. $ENV{MOJO_APP} ||= 'App';
  6.  
  7. use Mojolicious::Commands; Mojolicious::Commands->start;
  8.  
  9. package App;
  10. use common::sense;
  11.  
  12. use base 'Mojolicious';
  13.  
  14. sub startup {
  15. my $self = shift;
  16.  
  17. my $r = $self->routes;
  18.  
  19. my $auth = $r->bridge->to('auth#check');
  20. $auth->route('/about/')->to('pref#about');
  21.  
  22. $auth->route('/gift/')->to('gift#index');
  23.  
  24. my $album = $auth->bridge->to('album#allow');
  25. $album->route('/album/create/')->to('album#create');
  26. }
  27.  
  28. package App::Auth;
  29. use base 'Mojolicious::Controller';
  30.  
  31. sub check { 1 }
  32.  
  33. package App::Album;
  34. use base 'Mojolicious::Controller';
  35.  
  36. sub allow { 1 }
  37. sub create { shift->render_text(__PACKAGE__) }
  38.  
  39. package App::Gift;
  40. use base 'Mojolicious::Controller';
  41.  
  42. sub index { shift->render_text(__PACKAGE__) }
  43.  
  44. 1;
Add Comment
Please, Sign In to add comment