Method::Signatures::Simple 1.01 released to CPAN

I’m pleased to announce version 1.01 of Method::Signatures::Simple. It provides a little sugar for writing methods and functions. Chip Salzenberg requested the addition of a function keyword with the same signature processing, and kindly provided me with the implementation (on github).

Here’s some example code from the synopsis:

package User;
use Method::Signatures::Simple;

method new ($class: $name, $email) {
    my $user = {
        id    => new_id(42),
        name  => $name,
        email => $email,
    bless $user, $class;

func new_id ($seed) {
    state $id = $seed;

method name  { $self->{name};  }
method email { $self->{email}; }

Enjoy :)

Leave a comment

About rhesa

user-pic on CPAN on Github on Perlmonks