News for hackers. Stuff that matters.
Re:Perl as a career option by kbenson on Wednesday July 30, 2014 @07:33PM (#8111592)
Additionally, Moops[1] may be useful to get some extra sugar going. It's a meta module that includes a few other modules to give you a sane (Moose/Moo) object model, plus function and method signatures through Method::Signatures.

For example:

    use Moops;

    role NamedThing {
       has name => (is => "ro", isa => Str);
    }

    class Person with NamedThing;

    class Company with NamedThing;

    class Employee extends Person {
       has job_title => (is => "rwp", isa => Str);
       has employer  => (is => "rwp", isa => InstanceOf["Company"]);

       method change_job ( Object $employer, Str $title ) {
          $self->_set_job_title($title);
          $self->_set_employer($employer);
       }

       method promote ( Str $title ) {
          $self->_set_job_title($title);
       }
    }

[1] https://metacpan.org/pod/Moops

There are no comments on this comment yet.