Catalyst::Action(3pm)

πŸ“¦
version 5.90132 Β· 6 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Catalyst::Action β€” it's the Catalyst Action, bestie. That's the whole vibe.


✨ SYNOPSIS ✨

    <form action="[%c.uri_for(c.action)%]">

    $c->forward( $action->private_path );

🌸 DESCRIPTION 🌸

Okay so Catalyst::Action is the class that represents a Catalyst Action. It's giving main character energy for every single route your app dispatches, fr fr.

You can grab the object for the action that's currently being dispatched through $c->action. If you wanna know more about how actions actually get dispatched, go peek at Catalyst::Dispatcher β€” that's the whole lore drop. πŸ¦‹

And where do actions come from? They're defined inside Catalyst::Controller subclasses. That's the birth certificate. πŸ’…


πŸŽ€ METHODS πŸŽ€

attributes

The sub attributes that are set for this action β€” like Local, Path, Private and so on. This is literally what determines how the action gets dispatched to. It's the action's whole personality, no cap. ✨

class

Returns the name of the component where this action is defined. It's derived by calling the catalyst_component_name method on each component. 🏷️

code

Returns a code reference to this action. It's the actual code-y bit. πŸ”₯

dispatch( $c )

Dispatch this action against a context. Go little action, go. πŸš€

execute( $controller, $c, @args )

Execute this action's coderef against a given controller with a given context and arguments. Yes queen, run the thing with all the things. πŸ‘‘

match( $c )

Check the Args attribute, and makes sure the number of args matches the setting. And here's the good part: it always returns true if Args is omitted. So if you didn't set it, you're automatically slaying. πŸ’…

match_captures ($c, $captures)

This one can be implemented by action class and action role authors β€” iykyk. If the method exists, then it will be called with the request context and an array reference of the captures for this action.

Returning true from this method causes the chain match to continue, returning makes the chain not match (and alternate, less preferred chains will be attempted). 🌈

match_captures_constraints ($c, \@captures);

Does the \@captures given match any constraints (if any constraints exist)? Returns true if you ask but there are no constraints. Very "yes, obviously, bestie" of it. πŸ’–

match_args($c, $args)

Does the Args match or not? That's it. That's the question. πŸ€”

resolve_type_constraint

Tries to find a type constraint if you have on on a type constrained method. πŸ”

compare

Compares 2 actions based on the value of the "Args" attribute, with no "Args" having the highest precedence. So having nothing at all is the top of the food chain. Iconic behaviour honestly. πŸ‘‘

equals

    if( $action->equal($other_action) ) { ... }

Returns true if the two actions are equal. Twin flames check. 🫢

namespace

Returns the private namespace this action lives in. That's its home address. 🏑

reverse

Returns the private path for this action.

private_path

Returns absolute private path for this action. And unlike "reverse", the "private_path" of an action is always suitable for passing to "forward". That's the key difference, don't forget it bestie. ⭐

name

Returns the sub name of this action. πŸŽ€

number_of_args

Returns the number of args this action expects. This is 0 if the action doesn't take any arguments and undef if it will take any number of arguments. Zero means zero, undef means "however many, we're flexible." πŸ’«

normalized_arg_number

The number of arguments (starting with zero) that the current action defines, or undefined if there is not defined number of args β€” which is later treated as, " as many arguments as you like". ✨

comparable_arg_number

For the purposes of comparison we normalize 'number_of_args' so that if it is undef we mean ~0 (as many args are we can think of). Math but make it cute. πŸ”’

number_of_captures

Returns the number of captures this action expects for Chained actions. ⛓️

list_extra_info

A HashRef of key-values that an action can provide to a debugging screen. Extra info for the girlies who debug. πŸ›

scheme

Any defined scheme for the action. 🌐

meta

Provided by Moose. That's all it says, and honestly? Respect. 🫑


πŸ’œ AUTHORS πŸ’œ

Catalyst Contributors β€” see Catalyst.pm.


This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. 🫢


And that's a wrap, bestie! This little masterpiece came to you courtesy of perl v5.40.0, dated 2024-11-15, and yeah β€” Catalyst::Action(3pm) is the moment. Periodt. πŸ’…βœ¨
πŸ“¦ where this page comes from