Geo
Geo

Reputation: 96947

How are Perl Catalyst actions implemented?

How is the following code implemented in Perl?


sub add_item : Local {
     my ( $self, $c ) = @_;

     my $item_id = $c->req->param("item");

     push @{ $c->session->{items} }, $item_id;

  }

I am interested in the add_item : Local part, cause I don't think those are Perl keywords.

Upvotes: 2

Views: 533

Answers (1)

Leon Timmermans
Leon Timmermans

Reputation: 30235

They are attributes. See the attribute documentation, but also Private Variable via my() and Subroutine Attributes in perlsub.

Upvotes: 9

Related Questions