blib/lib/XAS/Exception.pm untested

filter: Statementstmt 0.0% 0 / 13 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 20 CC 3 SCAR 22.5
CC
3
Cov
0%
stack_trace
12.0
BEGIN
2.0
CRAP 9.5
1 package XAS::Exception;
2  
3 use base Badger::Exception;
4 $Badger::Exception::TRACE = 1;
5  
6 sub stack_trace {
7 my $self = shift;
8  
9 my @lines;
10  
11 if (my $stack = $self->{ stack }) {
12  
13 foreach my $caller (@$stack) {
14  
15 # ignore Try::Tiny lines
16  
17 next if (grep( $_ =~ /Try::Tiny/, @$caller ));
18 push(@lines, $self->message( caller => @$caller ));
19  
20 }
21  
22 }
23  
24 return join("\n", @lines);
25  
26 }
27  
28 1;
29  
30 __END__
31  
32 =head1 NAME
33  
34 XAS::Exception - The base exception class for the XAS environment
35  
36 =head1 DESCRIPTION
37  
38 This module defines a base exception class for the XAS Environment and
39 inherits from L<Badger::Exception|http://badgerpower.com/docs/Badger/Exception.html>.
40 The only differences is that it turns stack tracing on by default.
41  
42 =head1 METHODS
43  
44 =head2 stack_trace
45  
46 Removes any reference to Try::Tiny in the stack trace.
47  
48 =head1 SEE ALSO
49  
50 =over 4
51  
52 =item L<XAS|XAS>
53  
54 =back
55  
56 =head1 AUTHOR
57  
58 Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt>
59  
60 =head1 COPYRIGHT AND LICENSE
61  
62 Copyright (C) 2014 Kevin L. Esteb
63  
64 This library is free software; you can redistribute it and/or modify
65 it under the same terms as Perl itself, either Perl version 5.8.8 or,
66 at your option, any later version of Perl 5 you may have available.
67  
68 See L<http://dev.perl.org/licenses/> for more information.
69  
70 =cut