MooseX::Constructor::AllErrors - capture all constructor errors


MooseX-Constructor-AllErrors documentation Contained in the MooseX-Constructor-AllErrors distribution.

Index


Code Index:

NAME

Top

MooseX::Constructor::AllErrors - capture all constructor errors

VERSION

Top

version 0.016

SYNOPSIS

Top

  package MyClass;
  use MooseX::Constructor::AllErrors;

  has foo => (is => 'ro', required => 1);
  has bar => (is => 'ro', isa => 'Int');

  ...

  eval { MyClass->new(bar => "hello") };
  # $@->errors has two errors, not just the missing required attribute

DESCRIPTION

Top

MooseX::Constructor::AllErrors tries to capture every error generated during the construction of your objects, rather than halting after the first.

If there are errors, $@ will contain a MooseX::Constructor::AllErrors::Error::Constructor object. See its documentation for possible error types.

SEE ALSO

Top

Moose

AUTHOR

Top

  Hans Dieter Pearcey <hdp@cpan.org>

COPYRIGHT AND LICENSE

Top


MooseX-Constructor-AllErrors documentation Contained in the MooseX-Constructor-AllErrors distribution.

package MooseX::Constructor::AllErrors;
BEGIN {
  $MooseX::Constructor::AllErrors::VERSION = '0.016';
}

use Moose ();
use Moose::Exporter;

use MooseX::Constructor::AllErrors::Error;
use MooseX::Constructor::AllErrors::Error::Constructor;
use MooseX::Constructor::AllErrors::Error::Required;
use MooseX::Constructor::AllErrors::Error::TypeConstraint;

Moose::Exporter->setup_import_methods(
    base_class_roles => [ 'MooseX::Constructor::AllErrors::Role::Object' ],
    class_metaroles => {
        ($Moose::VERSION < 1.9900
            ? (constructor => ['MooseX::Constructor::AllErrors::Role::Meta::Method::Constructor'])
            : (class       => ['MooseX::Constructor::AllErrors::Role::Meta::Class'])),
    },
);

1;

__END__