2

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.

SW4
  • 69,876
  • 20
  • 132
  • 137
Geo
  • 93,257
  • 117
  • 344
  • 520

1 Answers1

9

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

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Leon Timmermans
  • 30,029
  • 2
  • 61
  • 110