File Coverage

blib/lib/MooseX/Exception/Rot13.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1 1     1   72721 use 5.008003;
  1         4  
  1         34  
2 1     1   5 use strict;
  1         2  
  1         31  
3 1     1   15 use warnings;
  1         1  
  1         61  
4              
5             package MooseX::Exception::Rot13;
6              
7             our $AUTHORITY = 'cpan:TOBYINK';
8             our $VERSION = '0.001';
9              
10 1     1   5 use Moose 2.1102 ();
  1         15  
  1         14  
11 1     1   5 use Moose::Exception ();
  1         1  
  1         102  
12              
13             Moose::Util::find_meta('Moose::Exception')->add_around_method_modifier(
14             message => sub {
15             my $next = shift;
16             my $self = shift;
17             my $mesg = $self->$next(@_);
18             $mesg =~ tr/N-ZA-Mn-za-m/A-Za-z/;
19             return $mesg;
20             },
21             );
22              
23             1;
24              
25             __END__
26              
27             =pod
28              
29             =encoding utf-8
30              
31             =head1 NAME
32              
33             MooseX::Exception::Rot13 - Rot13-encode Moose-generated exception messages
34              
35             =head1 SYNOPSIS
36              
37             setenv PERL5OPT '-MMooseX::Exception::Rot13'
38             prove -lv t/*.t
39              
40             =head1 DESCRIPTION
41              
42             This module globally applies rot13 encoding to all exceptions generated
43             by Moose 2.1102 and above. This makes it easy to find places in your
44             application code and test suite where you're relying on the exact text
45             of particular error messages. (When what you should be doing now is
46             checking C<< $exception->isa >>.)
47              
48             =head1 BUGS
49              
50             Please report any bugs to
51             L<http://rt.cpan.org/Dist/Display.html?Queue=MooseX-Exception-Rot13>.
52              
53             =head1 SEE ALSO
54              
55             L<Moose::Exception>,
56             L<http://en.wikipedia.org/wiki/ROT13>.
57              
58             =head1 AUTHOR
59              
60             Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
61              
62             =head1 COPYRIGHT AND LICENCE
63              
64             This software is copyright (c) 2013 by Toby Inkster.
65              
66             This is free software; you can redistribute it and/or modify it under
67             the same terms as the Perl 5 programming language system itself.
68              
69             =head1 DISCLAIMER OF WARRANTIES
70              
71             THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
72             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
73             MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
74