Clang::CastXML::Exception - Base exception class for Clang::CastXML
version 0.02
package Clang::CastXML::Exception::MyException { use Moose; extends 'Clang::CastXML::Exception'; has x => ( is => 'ro' ); sub message { my($self) = @_; sprintf "oops error with x = %d", $self->x; } } # dies with an object expression tha stringifies to # "oops error with x = 1 at xxx.pl line xxx" Clang::CastXML::Exception::MyException->throw( x => 1);
This is the base class for exceptions thrown by Clang::CastXML. It keeps track of the stack where the exception is thrown, and stringifies to a useful message. Subclasses may add appropriate properties, and must define a message method that generates the exception message.
This class consumes the Throwable and StackTrace::Auto roles.
my $message = $ex->message;
Get the message for the exception. This must be defined in the subclass.
my $string = $ex->to_string; my $string = "$ex";
Generate the human readable string diagnostic for the exception.
Clang::CastXML
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2020 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Clang::CastXML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Clang::CastXML
CPAN shell
perl -MCPAN -e shell install Clang::CastXML
For more information on module installation, please visit the detailed CPAN module installation guide.