Maypole...ew::Base(3)

πŸ“¦
version 2.13 Β· 2 versions
, in fedora 43

πŸ’– 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->output and return OK if processing was successful 🫢
  • or populate $r->error and return ERROR if it fails 😭
That's the whole vibe check right there: OK means slay, ERROR means 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