Moops

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    Moops - Moops Object-Oriented Programming Sugar

SYNOPSIS
       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);
          }
       }

STATUS
    Unstable.

    Will probably never be stable.

    A lot of the modules that Moops is built on have problems. In particular,
    Devel::CallParser is broken on a lot of Perl versions, and Parse::Keyword
    has *fundamental errors in the way it handles closures* (which Moops works
    around using PadWalker).

    Moops will remain on CPAN for the foreseeable future and I'll continue to
    accept patches that fix bugs, but don't expect any new features to be
    added.

    For a replacement, consider Zydeco. It's not a drop-in replacement but it
    has a similar syntax to Moops, and provides many of the same features.

DESCRIPTION
    Moops is sugar for declaring and using roles and classes in Perl.

    The syntax is inspired by MooseX::Declare, and Stevan Little's
    p5-mop-redux project (which is in turn partly inspired by Perl 6).

    Moops has fewer than half of the dependencies as MooseX::Declare, loads in
    about 25% of the time, and the classes built with it run significantly
    faster. Moops does not use Devel::Declare, instead using Perl's pluggable
    keyword API; *this requires Perl 5.14 or above*.

    Moops uses Moo to build classes and roles by default, but allows you to
    use Moose if you desire. (And Mouse experimentally.)

  Classes
    The `class` keyword declares a class:

       class Foo {
          # ...
       }

    A version number can be provided:

       class Foo 1.2 {
          # ...
       }

    If no version is provided, your class' $VERSION variable is set to the
    empty string; this helps the package be seen by Class::Load.

    If your class extends an existing class through inheritance, or consumes
    one or more roles, these can also be provided when declaring the class.

       class Foo::Bar 1.2 extends Foo 1.1 with Magic::Monkeys {
          # ...
       }

    If you use Moops within a package other than `main`, then package names
    used within the declaration are "qualified" by that outer package, unless
    they contain "::". So for example:

       package Quux;
       use Moops;
   
       class Foo { }       # declares Quux::Foo
   
       class Xyzzy::Foo    # declares Xyzzy::Foo
          extends Foo { }  # ... extending Quux::Foo
   
       class ::Baz { }     # declares Baz

    If you wish to use Moose or Mouse instead of Moo; include that in the



( run in 1.065 second using v1.01-cache-2.11-cpan-39bf76dae61 )