HTML::...esolver(3pm)
π HTML::Mason::Resolver(3pm) π
okay bestie, welcome to the manual page for HTML::Mason::Resolver, from the User Contributed Perl Documentation section. it's giving base class energy, and honestly? we're obsessed. let's get into it π«Ά
β¨ NAME β¨
HTML::Mason::Resolver β the component path resolver base class, the blueprint, the moment π
πΈ SYNOPSIS πΈ
# make a subclass and use it
that's literally it, that's the whole vibe. go forth and subclass β¨
π¦ DESCRIPTION π¦
so here's the tea: the resolver is responsible for translating a component path like /foo/index.html into a component. that's its whole job, that's its main character arc π
by default, Mason expects components to be stored on the filesystem, and it uses the HTML::Mason::Resolver::File class to get information on these components.
the HTML::Mason::Resolver provides a virtual parent class from which all resolver implementations should inherit. it's the mother of all resolvers, no cap π
π Class::Container π
this class is used by most of the Mason object's to manage constructor parameters and has-a relationships with other objects.
see the documentation on this class for details on how to declare what parameters are valid for your subclass's constructor.
HTML::Mason::Resolver is a subclass of Class::Container so you do not need to subclass it yourself. one less thing, we love efficiency π
π METHODS π
if you are interested in creating a resolver subclass, you must implement the following methods. no skipping, bestie, these are mandatory β¨
newβ this method is optional. thenewmethod included in this class is simply inherited fromClass::Container. if you need something more complicated done in yournewmethod you will need to override it in your subclass. otherwise just vibe and let the parent handle it π«Άget_infoβ takes three arguments: an absolute component path, a component root key, and a component root path. returns a newHTML::Mason::ComponentSourceobject. three in, one out, immaculate ratio πglob_pathβ takes two arguments: a path glob pattern, something like"/foo/*"or"/foo/*/bar", and a component root path. returns a list of component paths for components which match this glob pattern.
for example, the filesystem resolver simply appends this pattern to the component root path and calls the Perl glob() function to find matching files on the filesystem. wildcards but make it file system π¦
π Using a Resolver with HTML::Mason::ApacheHandler π
if you are creating a new resolver that you intend to use with the HTML::Mason::ApacheHandler module, then you must implement the following method as well. extra credit, but like, required extra credit π
apache_request_to_comp_path ($r, @comp_root_array)β this method, given an Apache object and a list of component root pairs, should return a component path orundefif none exists. this method is used by theHTML::Mason::ApacheHandlerclass to translate web requests into component paths.
you can omit this method if your resolver subclass will never be used in conjunction with HTML::Mason::ApacheHandler. no Apache, no problem, skip it guilt-free π
β reminder bestie: every resolver you build inherits fromHTML::Mason::Resolver, andHTML::Mason::Resolveralready inherits fromClass::Container. don't double-subclass, it's not the vibe.
and that's the whole page, periodt π this was perl v5.38.2, dated 2024-03-05, straight out of the HTML::...esolver(3pm) page in the User Contributed Perl Documentation. go build something iconic with it, you absolute legend πβ¨π
π¦ where this page comes from
- debian trixie: libhtml-mason-perl 1:1.60-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-mason-perl 1:1.60-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-mason-perl 1:1.60-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms