NAME

Mojo::Manual::FAQ - Frequently Asked Questions

QUESTIONS

Do i have to use Mojo::Base?

Absolutely not, you could just use any other accessor generator in your modules, Mojo::Base is just a minimalistic base class and will stay out of your way.

Do i have to use Mojo::Template?

Not at all, it is just a convenient default option and can be replaced with any other template engine out there.

Why do my programs break if i use content instead of body?

The content attribute of Mojo::Message has to contain a special Mojo::Content object which offers advanced HTTP body manipulation functions. The body method is a wrapper around that and what you will want to use in most cases.

$tx->res->body('Hello World!');

If you want to send a file for example, then content would be the right choice.

my $asset = Mojo::Asset::File->new;
$asset->path('/etc/passwd');
$tx->res->content->asset($asset);