| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | =head1 NAME | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | Test::Run::Obj::Error - an error class hierarchy for Test::Run. | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | This module provides an error class hieararchy for Test::Run. This is used | 
| 8 |  |  |  |  |  |  | for throwing exceptions that should be handled programatically. | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | =head1 METHODS | 
| 11 |  |  |  |  |  |  | =cut | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | package Test::Run::Obj::Error; | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 15 |  |  | 15 |  | 21354 | use strict; | 
|  | 15 |  |  |  |  | 28 |  | 
|  | 15 |  |  |  |  | 393 |  | 
| 17 | 15 |  |  | 15 |  | 77 | use warnings; | 
|  | 15 |  |  |  |  | 25 |  | 
|  | 15 |  |  |  |  | 406 |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 15 |  |  | 15 |  | 967 | use Moose; | 
|  | 15 |  |  |  |  | 485287 |  | 
|  | 15 |  |  |  |  | 232 |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 15 |  |  | 15 |  | 118397 | use Test::Run::Base::Struct; | 
|  | 15 |  |  |  |  | 58 |  | 
|  | 15 |  |  |  |  | 484 |  | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 15 |  |  | 15 |  | 106 | use Scalar::Util (); | 
|  | 15 |  |  |  |  | 31 |  | 
|  | 15 |  |  |  |  | 344 |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 15 |  |  | 15 |  | 82 | use vars qw(@ISA @fields); | 
|  | 15 |  |  |  |  | 28 |  | 
|  | 15 |  |  |  |  | 865 |  | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 15 |  |  | 15 |  | 81 | use MRO::Compat; | 
|  | 15 |  |  |  |  | 28 |  | 
|  | 15 |  |  |  |  | 1088 |  | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub _polymorphic_stringify | 
| 31 |  |  |  |  |  |  | { | 
| 32 | 24 |  |  | 24 |  | 369 | my $self = shift; | 
| 33 | 24 |  |  |  |  | 108 | return $self->stringify(@_); | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | use overload | 
| 37 | 15 |  |  |  |  | 131 | '""' => \&_polymorphic_stringify, | 
| 38 |  |  |  |  |  |  | 'fallback' => 1 | 
| 39 | 15 |  |  | 15 |  | 80 | ; | 
|  | 15 |  |  |  |  | 30 |  | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | extends(qw(Test::Run::Base::Struct)); | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | has 'package' => (is => "rw", isa => "Str"); | 
| 44 |  |  |  |  |  |  | has 'file' => (is => "rw", isa => "Str"); | 
| 45 |  |  |  |  |  |  | has 'line' => (is => "rw", isa => "Num"); | 
| 46 |  |  |  |  |  |  | has 'text' => (is => "rw", isa => "Str"); | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =head2 BUILD | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | For Moose. | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | =cut | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | sub BUILD | 
| 55 |  |  |  |  |  |  | { | 
| 56 | 11 |  |  | 11 | 1 | 136 | my $self = shift; | 
| 57 |  |  |  |  |  |  |  | 
| 58 | 11 |  |  |  |  | 115 | my ($pkg,$file,$line) = caller(1); | 
| 59 | 11 |  |  |  |  | 509 | $self->package($pkg); | 
| 60 | 11 |  |  |  |  | 428 | $self->file($file); | 
| 61 | 11 |  |  |  |  | 435 | $self->line($line); | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | =head2 $self->stringify() | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | Stringifies the error. Returns the text() field by default. | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | =cut | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | sub stringify | 
| 71 |  |  |  |  |  |  | { | 
| 72 | 25 |  |  | 25 | 1 | 42 | my $self = shift; | 
| 73 | 25 |  |  |  |  | 952 | return $self->text(); | 
| 74 |  |  |  |  |  |  | } | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | 1; | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | package Test::Run::Obj::Error::TestsFail; | 
| 79 |  |  |  |  |  |  |  | 
| 80 | 15 |  |  | 15 |  | 3382 | use vars qw(@ISA); | 
|  | 15 |  |  |  |  | 38 |  | 
|  | 15 |  |  |  |  | 887 |  | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | @ISA = (qw(Test::Run::Obj::Error)); | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | package Test::Run::Obj::Error::TestsFail::NoTestsRun; | 
| 85 |  |  |  |  |  |  |  | 
| 86 | 15 |  |  | 15 |  | 125 | use vars qw(@ISA); | 
|  | 15 |  |  |  |  | 35 |  | 
|  | 15 |  |  |  |  | 888 |  | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | @ISA = (qw(Test::Run::Obj::Error::TestsFail)); | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | package Test::Run::Obj::Error::TestsFail::Other; | 
| 91 |  |  |  |  |  |  |  | 
| 92 | 15 |  |  | 15 |  | 80 | use vars qw(@ISA); | 
|  | 15 |  |  |  |  | 40 |  | 
|  | 15 |  |  |  |  | 925 |  | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | @ISA = (qw(Test::Run::Obj::Error::TestsFail)); | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | package Test::Run::Obj::Error::TestsFail::NoOutput; | 
| 97 |  |  |  |  |  |  |  | 
| 98 | 15 |  |  | 15 |  | 86 | use vars qw(@ISA); | 
|  | 15 |  |  |  |  | 34 |  | 
|  | 15 |  |  |  |  | 1027 |  | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | @ISA = (qw(Test::Run::Obj::Error::TestsFail)); | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | package Test::Run::Obj::Error::TestsFail::Bailout; | 
| 103 |  |  |  |  |  |  |  | 
| 104 | 15 |  |  | 15 |  | 92 | use Moose; | 
|  | 15 |  |  |  |  | 32 |  | 
|  | 15 |  |  |  |  | 143 |  | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | extends(qw(Test::Run::Obj::Error::TestsFail)); | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | has 'bailout_reason' => (is => "rw", isa => "Str"); | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | sub stringify | 
| 112 |  |  |  |  |  |  | { | 
| 113 | 8 |  |  | 8 | 1 | 14 | my $self = shift; | 
| 114 | 8 | 50 |  |  |  | 324 | return "FAILED--Further testing stopped" . | 
| 115 |  |  |  |  |  |  | ($self->bailout_reason() ? | 
| 116 |  |  |  |  |  |  | (": " . $self->bailout_reason() . "\n") : | 
| 117 |  |  |  |  |  |  | ".\n" | 
| 118 |  |  |  |  |  |  | ); | 
| 119 |  |  |  |  |  |  | } | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | package Test::Run::Obj::Error::Straps; | 
| 122 |  |  |  |  |  |  |  | 
| 123 | 15 |  |  | 15 |  | 96253 | use vars qw(@ISA); | 
|  | 15 |  |  |  |  | 34 |  | 
|  | 15 |  |  |  |  | 949 |  | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | @ISA = (qw(Test::Run::Obj::Error)); | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | package Test::Run::Obj::Error::Straps::CannotRunPerl; | 
| 128 |  |  |  |  |  |  |  | 
| 129 | 15 |  |  | 15 |  | 77 | use vars qw(@ISA); | 
|  | 15 |  |  |  |  | 28 |  | 
|  | 15 |  |  |  |  | 1201 |  | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | @ISA = (qw(Test::Run::Obj::Error::Straps)); | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | 1; | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =head1 LICENSE | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | This file is licensed under the MIT X11 License: | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | http://www.opensource.org/licenses/mit-license.php | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =cut | 
| 142 |  |  |  |  |  |  |  |