Search code examples
perlmojolicious

Mojo: Class "Foo::Controller::OAuth" is not a controller


For some reason I get this message in my log,

Class "Foo::Controller::OAuth" is not a controller

However, in my Foo::Controller::OAuth I have at the very top,

use Mojo::Base 'Mojolicious::Controller';

What other things can cause this error?


Solution

  • You can get this error if the package name is wrong. For example

    package Foo::Controller::Oauth; # notice the lower-case a in 'auth'
    use Mojo::Base 'Mojolicious::Controller';
    

    vs

    package Foo::Controller::Oauth; # notice the upper-case A in 'Auth'
    use Mojo::Base 'Mojolicious::Controller';