Search code examples
perlmodulemason

What does this line of perl code mean?


I have a perl mason file and one of the lines looks like this:

$result = PI::Membership::Service->cancel(name => $name)

What exactly does that mean? Is it calling another module? Is it object oriented perl code?

Thanks


Solution

  • It is calling (invoking) the subroutine PI::Membership::Service::cancel with three arguments.

    1. "PI::Membership::Service"
    2. "name"
    3. $name

    Given normal naming conventions, this is calling a subroutine called cancel in the package PI::Membership::Service, defined in a file named PI/Membership/Service.pm somewhere along your @INC path (there are many abnormal naming conventions, however, so there is no guarantee you will find such a file). And if the PI::Membership::Service package (class) inherits from one or more other packages, the cancel subroutine might actually be defined in one of those packages.

    More details in perlobj.