The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MooseX::Exception::Base::Stringify - Traits class for attributes that are to be stringified.

VERSION

This documentation refers to MooseX::Exception::Base::Stringify version 0.1.

SYNOPSIS

   use Moose;
   use MooseX::Exception::Base::Stringify;

   # cause a MooseX::Exception::Base to output this value
   has my_attrib => (
       is     => 'rw',
       isa    => 'Str',
       traits => [qw{MooseX::Exception::Stringify}],
   );

   # custom stringification from an object
   has my_date => (
       is        => 'rw',
       isa       => 'DateTime',
       traits    => [qw{MooseX::Exception::Stringify}],
       stringify => sub {$_->ymd},
   );

   # causes the stringified object to show the my_message value
   # something like 'Message : ' . $obj->my_message
   has my_message => (
       is            => 'rw',
       isa           => 'Str',
       traits        => [qw{MooseX::Exception::Stringify}],
       stringify_pre => 'Message : ',
   );

   # like with stringify_pre the value has stringify_post appended
   # $obj->my_post . ' km/h'
   has my_post => (
       is             => 'rw',
       isa            => 'Num',
       traits         => [qw{MooseX::Exception::Stringify}],
       stringify_post => ' km/h',
   );

DESCRIPTION

Defines the trait (MooseX::Exception::Stringify) for MooseX::Exception::Base objects that want other parameters to be stringified along with the error object.

INCOMPATIBILITIES

BUGS AND LIMITATIONS

There are no known bugs in this module.

Please report problems to Ivan Wills (ivan.wills@gmail.com).

Patches are welcome.

AUTHOR

Ivan Wills - (ivan.wills@gmail.com)

LICENSE AND COPYRIGHT

Copyright (c) 2012 Ivan Wills (14 Mullion Close Hornsby Heights NSW Australia 2077). All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.