Exception::Assertion.3pm

Langue: en

Autres versions - même langue

Version: 2010-05-06 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Exception::Assertion - Thrown when assertion failed

SYNOPSIS

   use Exception::Assertion;
 
   sub assert_foo {
       my $self = eval { $_[0]->isa(__PACKAGE__) } ? shift : __PACKAGE__;
       my ($condition, $message) = @_;
       Exception::Assertion->throw(
           message => $message,
           reason  => 'foo failed',
       );
   }
 
   assert_foo( 0, 'assert_foo failed' );
 
 

DESCRIPTION

This class extends standard Exception::Base and is thrown when assertion is failed.

BASE CLASSES

*
Exception::Base

CONSTANTS

ATTRS
Declaration of class attributes as reference to hash.

See Exception::Base for details.

ATTRIBUTES

This class provides new attributes. See Exception::Base for other descriptions.
message : Str = Unknown assertion failed {rw}
Contains the message of the exception. This class overrides the default value from Exception::Base class.
verbosity : Int = 3 {rw}
The default verbosity for assertion exception is raised to 3. This class overrides the default value from Exception::Base class.
reason : Str {rw}
Contains the additional message filled by assertion method.
string_attributes : ArrayRef = ['message', 'reason']
Meta-attribute contains the format of string representation of exception object. This class overrides the default value from Exception::Base class.

SEE ALSO

Exception::Base, Test::Assertion.

BUGS

If you find the bug, please report it.

AUTHOR

Piotr Roszatycki <dexter@debian.org>

LICENSE

Copyright (C) 2008, 2009 by Piotr Roszatycki <dexter@debian.org>.

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

See <http://www.perl.com/perl/misc/Artistic.html>