I followed the Rose::DB::Object tutorial on CPAN and set up three packages.
package My::DB::Object;
use My::DB;
use base qw(Rose::DB::Object);
sub init_db { My::DB->new }
package My::DB;
use base qw(Rose::DB);
...
package Motorcycle;
use base 'My::DB::Object';
__PACKAGE__->meta->setup
(
...
);
__PACKAGE__->meta->make_manager_class('motorcycles');
In the application:
package main;
use Motorcycle;
use Mojolicious::Lite;
This failed to compile with this error:
My/DB/Object did not return a true value <eval 2> line 2…
Regards and thanks.
While I can't say I fully understand what it is you are trying to accomplish, the error you are seeing is a fairly common one. Any file/module that is included with a
useorrequiremust return a "true" value. This is usually accomplished by ending that file with the line1;, that is to say simply a command that is true (as opposed to 0 being false). Look at any other file ending in .pm on your system and it is likely to end this way.You can also read more in
perldoc perlmod, or there is this statement fromperldoc -f require: