Mojo::Home(3)

πŸ’– Mojo::Home πŸ’–

okay so bestie, welcome to Mojo::Home β€” from the Perl user docs, and honestly? home sweet home 🏑✨ That's literally the tagline, I'm not even kidding.


✨ SYNOPSIS ✨

like, here's the whole vibe:

use Mojo::Home;

# Find and manage the project root directory
my $home = Mojo::Home->new;
$home->detect;
say $home->child('templates', 'layouts', 'default.html.ep');
say "$home";

no cap, that's it. that's the whole entrance exam πŸŽ€


🌸 DESCRIPTION 🌸

Mojo::Home is a container for home directories, and it's built on top of Mojo::File β€” so like, it's got the whole family tree backing it up 🫢


πŸ‘‘ METHODS πŸ‘‘

okay so the way this works: Mojo::Home inherits all methods from Mojo::File (all of them, she's a nepo baby and we love her for it πŸ’…) and then implements these new ones:

πŸ¦‹ detect

$home = $home->detect;
$home = $home->detect('My::App');

this is the main character method fr fr β€” it detects the home directory from the value of the MOJO_HOME environment variable, or from the location of the application class. iykyk 😌

πŸŽ€ rel_file

my $path = $home->rel_file('foo/bar.html');

returns a new Mojo::Home object that's relative to the home directory. slay, she ate πŸ“


⭐ OPERATORS ⭐

Mojo::Home inherits all overloaded operators from Mojo::File. periodt, nothing new to learn here πŸ’œ


🌈 SEE ALSO 🌈

go read 'em, they're iconic πŸ‘‘


k bye bestie!! 🧚 this was Mojo::Home(3) from perl v5.42.0, dated 2026-07-15 β€” mwah, see you in the next manpage πŸ’–πŸŽ€πŸ”₯

πŸ“¦ where this page comes from