NAME

MooseX::Interface::Internals - the classes and traits used under the hood of MooseX::Interface

METAROLE TRAIT

MooseX::Interface::Trait::Role

This role is applied to your interface's metarole object. If you want to get to know the internals of MooseX::Interface, this is the place to start.

As well as providing the following methods, it also includes method modifiers for add_required_methods (to deal with method signatures) and apply (to trigger interface integrity checks).

is_interface

Boolean attribute.

test_cases

Arrayref of MooseX::Interface::Meta::TestCase objects.

integrity_checked

Boolean indicating whether the interface's integrity has been checked yet. An explicit one or __PACKAGE__->meta->check_interface_integrity will happily check the interface integrity every single time, but when a class implements an interface, we don't want to have to keep rechecking.

installed_modifiers

Hashref of sub name to refaddr pairs of all "before" method modifiers that have been set up to implement required method signature checks.

add_constant($name, $value)

Define a constant.

add_test_case($coderef, $name)
add_test_case($blessed_testcase)

Accepts either a coderef+name pair, or a MooseX::Interface::Meta::TestCase object.

test_implementation($object)

Tests an instance of an implementation of the interface.

find_problematic_methods

Returns a list of Moose::Meta::Method objects judged to be problematic to the integrity of the interface.

find_problematic_method_modifiers

All method modifiers are problematic, except those that implement method signature checks.

check_interface_integrity

Calls find_problematic_methods and find_problematic_method_modifiers, and croaks if either of them return any problems.

CLASSES

MooseX::Interface::Meta::Method::Constant

Trivial subclass of Moose::Meta::Role::Method.

MooseX::Interface::Meta::Method::Required

Trivial subclass of Moose::Meta::Role::Method::Required.

MooseX::Interface::Meta::Method::Required::WithSignature

Subclass of Moose::Meta::Role::Method::Required.

signature

An arrayref of strings or Moose::Meta::TypeConstraint objects.

check_signature($arglist)

Given an arrayref of method arguments (not including the invocant), checks them against the signature. Returns false if the signature is violated.

MooseX::Interface::Meta::TestCase

Represents an embedded test case.

name
code
associated_interface
test_instance($instance)

MooseX::Interface::Meta::TestReport

Class with much overloading, returned by test_implementation.

TODO: these objects might want attributes to retrieve the object tested plus the interface metarole.

passed

Arrayref of passing test cases.

failed

Arrayref of failing test cases.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=MooseX-Interface.

SEE ALSO

MooseX::Interface.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2012 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.