Guest User

Untitled

a guest
Oct 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. package MojoReader;
  2. use Mojo::Base 'Mojolicious';
  3. use MojoReader::Model::Addfeed;
  4.  
  5. sub startup {
  6. my $self = shift;
  7.  
  8. # Load configuration from hash returned by "my_app.conf"
  9. my $config = $self->plugin('Config');
  10.  
  11. $self->helper(addfeed => sub {
  12. state $addfeed = MojoReader::Model::Addfeed->new(storage_path => $config->{storage_path})
  13. });
  14. ...
  15.  
  16. }
  17.  
  18. package MojoReader::Model::Addfeed;
  19. use Mojo::Base -signatures;
  20.  
  21. has 'storage_path';
  22.  
  23. sub check ($self) {
  24. if ( -e $self->storage_path ) {
  25. return 1;
  26. }
  27. # Fail
  28. return undef;
  29. }
  30.  
  31. 1;
Add Comment
Please, Sign In to add comment