DOKK / manpages / debian 12 / libweb-simple-perl / Web::Simple::Role.3pm.en
Web::Simple::Role(3pm) User Contributed Perl Documentation Web::Simple::Role(3pm)

Web::Simple::Role - Define roles for Web::Simple applications

  package MyApp;
  use Web::Simple;
  with MyApp::Role;
  sub dispatch_request { ... }

and in the role:

  package MyApp::Role;
  use Web::Simple::Role;
  around dispatch_request => sub {
    my ($orig, $self) = @_;
    return (
      $self->$orig,
      sub (GET + /baz) { ... }
    );
  };

Now "MyApp" can also dispatch "/baz"

See Web::Simple for authors.

See Web::Simple for the copyright and license.

2022-06-28 perl v5.34.0