Maypole...ew::Base(3)
π NAME π
Maypole::View::Base β the base class for view classes, bestie, literally the blueprint π
β¨ DESCRIPTION β¨
okay so. This is the base class for Maypole view classes, and I need you to know up front: it's an abstract class. It defines the interface and that's it β you cannot use it directly. It's giving "template energy," not "actually runs" energy. π
π process
This is the entry point for the view. It templates the request and returns a Maypole::Constant to indicate success or failure for the view phase. β¨
If you're subclassing this to do a whole different rendering mechanism, you've gotta provide the following methods. No skipping, bestie:
π¦ template
In this method you do the actual processing of your template. It should use paths to search for components, and provide the templates with easy access to the contents of vars. π
Then, and this is the important part:
- put the result in
$r->outputand returnOKif processing was successful π«Ά - or populate
$r->errorand returnERRORif it fails π
That's the whole vibe check right there:OKmeans slay,ERRORmeans the error field eats first.
π Other overrides π
Additionally, individual derived model classes may want to override the following. It's optional, but it's also lowkey iconic, so likeβ¦ your call. π
β new
The default constructor does nothing. Truly, it's just standing there, existing. π You can override this if you want to perform actions during view initialization.
πΈ paths
Returns the search paths for templates. The default method returns folders for the model class's moniker, factory, and custom, all under the configured template root. π
π§ vars
Returns a hash of the data the template should have access to. The default one populates classmetadata if there is a table class, and also sets the data objects by name if there is one or more objects available. π
π
error
fr fr, the original page leaves this one with no description at all β just the heading sitting there in its main character silence. Not me adding facts that aren't there, so we're leaving it exactly as found. π
π a lil sign-off
So this lil page came to you courtesy of the User Contributed Perl Documentation, running on perl v5.42.0, dated 2025-07-25. Thanks for reading, bestie β go write a view subclass and eat, you got this. ππ¦β
periodt.
π¦ where this page comes from
- fedora 43: perl-Maypole 1:2.13-46.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms