Cataly...chType(3pm)

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

✨ NAME ✨

Catalyst::DispatchType β€” the DispatchType Base Class, aka the blueprint all the dispatch types are built on πŸ’…

(also hi bestie, this is a page from the User Contributed Perl Documentation set, and the whole thing is literally just called Cataly...chType in the header because terminals are tiny. iconic of them tbh.)


πŸŽ€ SYNOPSIS πŸŽ€

See Catalyst.

that's it. that's the synopsis. go read Catalyst. she's the main character, this is her supporting cast 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so. This is an abstract base class for Dispatch Types. Abstract means you don't just, like, instantiate it and vibe β€” it's a template that the real dispatch types inherit from, no cap.

From a code perspective, dispatch types are the little guys whose whole job is figuring out which actions to call for a given request URL. Like a matchmaker but for URLs and subroutines, and honestly? she ate.

Website authors will typically work with them via subroutine name attributes β€” you know, the attribute vibe you sprinkle on your subs. And if you want the full description of dispatch at the attribute/URL level, that's all in Catalyst::Manual::Intro. go read it, it's giving tutorial energy 🌈


πŸ‘‘ METHODS πŸ‘‘

heads up bestie: every single one of these is an abstract method that dispatch types are supposed to implement themselves. this base class is not doing the work, she's delegating. periodt.

🌸 $self->list($c)

abstract method, to be implemented by dispatchtypes. Called to display info in debug log. yes it's literally just for spitting info into the debug log. lowkey important, highkey unglamorous πŸ’€

🌸 $self->match( $c, $path )

abstract method, to be implemented by dispatchtypes. Returns true if the dispatch type matches the given path. true or false, that's the whole vibe check right there ✨

🌸 $self->register( $c, $action )

abstract method, to be implemented by dispatchtypes. Takes a context object and a Catalyst::Action object.

Should return true if it registers something, or false otherwise. no in-between, she's decisive πŸ’…

🌸 $self->uri_for_action( $action, \@captures )

abstract method, to be implemented by dispatchtypes. Takes a Catalyst::Action object and an arrayref of captures, and should return either:

  • a URI part which, if placed in $c->req->path, would cause $self->match to match this action and set $c->req->captures to the supplied arrayref β€” or
  • undef if she literally cannot do it 😭

that's the whole deal. build the URI, or admit defeat with undef.

🌸 $self->expand_action

Default fallback, returns nothing. See Catalyst::Dispatcher for more info about expand_action. she does nothing and she's honest about it, we respect that 🫢


πŸ’– AUTHORS πŸ’–

Catalyst Contributors, see Catalyst.pm. it's a whole group chat of contributors, and honestly? they snapped.


This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. free as in freedom, free as in go wild bestie πŸŽ€


and that's the page!! written by the Catalyst Contributors, living in the User Contributed Perl Documentation collection, and this particular copy is from perl v5.40.0, dated 2024-11-15 β€” mwah, sending you off with a little forehead kiss and a working match method πŸ’‹βœ¨

πŸ“¦ where this page comes from