Search code examples
perlmodulemojolicious

Changing modules without restarting Morbo (Mojolicious)


I have got a Mojolicious::Lite app:

use Mojolicious::Lite;
use User;

get '/' => sub {
   my $self = shift;
   $self->render('index');
};

get '/login' => sub {
   my $self = shift;
   $self->redirect_to(User::getLoginLink);
};

I use Morbo in development. I don't need to restart Morbo if I change code in this 2 subs, but User::getLoginLink will be updated only with morbo's restart. Is it possible to make morbo watch for changes in modules? (for example, 'User' module)


Solution

  • You can use option -w of morbo server. By default morbo watch for changes only application script and catalogs lib and templates in current directory.

    Example of usage from morbo help:

    morbo -w /usr/local/lib -w public myapp.pl