MooseX::CompileTime::Traits(3pm)

MooseX::CompileTime::Traits3pm

Allow compile time traits for classes/roles

Usage

    role Bar(Int :$bar) { method bar { $bar + 2 } }
    role Baz(Int :$baz) { method baz { $baz + 4 } }
    class Foo with MooseX::CompileTime::Traits { }
    class Flarg with MooseX::CompileTime::Traits { }
    ...
    use Foo traits => [ Bar => { bar => 2 } ];
    use Flarg traits => [ Bar => { bar => 1 }, Baz => { baz => 1} ];
    Foo->new()->bar(); # 4
    my $flarg = Flarg->new();
    $flarg->bar(); # 3
    $flarg->baz(); # 5

Version

version 1.102570

Overview

MooseX::CompileTime::Traits allows role application at compile time via use statements. What this class does is provide an import method that will apply each of the roles (along with any arguments for parameterized roles).

Roles and their arguments should be provided as an ArrayRef of tuples.

Simply 'with' the role to gain the functionality

Public_methods

import

    (ClassName $class: ArrayRef :$traits?)

import is provided such that when your class or role is use'd it can take additional arguments that will be validatated and interpreted as roles or traits that need to be applied.

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 4 times.

  1. 6.0
  2. 7–9
  3. 10
  4. 11
  5. 12–13

Author

Nicholas Perez <[email protected]>

From libmoosex-compiletime-traits-perl 1.102570-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.