Dave Rolsky > Specio-0.08 > Specio::Exception

Download:
Specio-0.08.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.08   Source   Latest Release: Specio-0.11

NAME ^

Specio::Exception - A Throwable::Error subclass for type constraint failures

VERSION ^

version 0.08

DESCRIPTION ^

This is a subclass of Throwable::Error which adds a few additional attributes specific to type constraint failures.

DESCRIPTION ^

  use Try::Tiny;

  try {
      $type->validate_or_die($value);
  }
  catch {
      if ( $_->isa('Specio::Exception') ) {
          print $_->message(), "\n";
          print $_->type()->name(), "\n";
          print $_->value(), "\n";
      }
  };

API ^

The two attributes it adds are type and value, both of which are required. The type must be a Specio::Constraint::Role::Interface object, and the value can be anything (including undef).

AUTHOR ^

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2013 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: