| 1 | package Test::Pcuke::Executor::StepFailure; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | =head1 NAME | ||||||||||||
| 7 | |||||||||||||
| 8 | Test::Pcuke::Executor::StepFailure - The great new Test::Pcuke::Executor::StepFailure! | ||||||||||||
| 9 | |||||||||||||
| 10 | =head1 SYNOPSIS | ||||||||||||
| 11 | |||||||||||||
| 12 | Here is a somewhat artificial example: | ||||||||||||
| 13 | |||||||||||||
| 14 | use Test::Pcuke::Executor::StepFailure; | ||||||||||||
| 15 | |||||||||||||
| 16 | my $exception; | ||||||||||||
| 17 | |||||||||||||
| 18 | { | ||||||||||||
| 19 | local $@; | ||||||||||||
| 20 | eval { | ||||||||||||
| 21 | die Test::Pcuke::Executor::StepFailure->new('message'); | ||||||||||||
| 22 | }; | ||||||||||||
| 23 | $exception = $@; | ||||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | if (ref $exception eq 'Test::Pcuke::Executor::StepFailure' ) { | ||||||||||||
| 27 | print "Failure: " . $exception->message; | ||||||||||||
| 28 | } | ||||||||||||
| 29 | else { | ||||||||||||
| 30 | die $exception; | ||||||||||||
| 31 | } | ||||||||||||
| 32 | |||||||||||||
| 33 | |||||||||||||
| 34 | =head1 METHODS | ||||||||||||
| 35 | |||||||||||||
| 36 | =head2 new $message | ||||||||||||
| 37 | |||||||||||||
| 38 | =cut | ||||||||||||
| 39 | |||||||||||||
| 40 | 2 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 41 | 2 | my ($class, $msg) = @_; | |||||||||||
| 42 | |||||||||||||
| 43 | 2 | bless { _msg => $msg}, $class; | |||||||||||
| 44 | } | ||||||||||||
| 45 | |||||||||||||
| 46 | =head2 message | ||||||||||||
| 47 | |||||||||||||
| 48 | Returns a message passed to the constructor | ||||||||||||
| 49 | |||||||||||||
| 50 | =cut | ||||||||||||
| 51 | |||||||||||||
| 52 | 1 | ▶ | sub message { | ||||||||||
|
Subroutine
message: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||
| 53 | 1 | my ($self) = @_; | |||||||||||
| 54 | 1 | ▶ | return $self->{_msg} || q{}; | ||||||||||
|
Condition50%1/2
$self->{'_msg'} || ''
MC/DC0%0/1
$self->{'_msg'} || ''
$self->{'_msg'}
Truth table50%1/2
A
A= $self->{'_msg'}
| |||||||||||||
| 55 | } | ||||||||||||
| 56 | |||||||||||||
| 57 | |||||||||||||
| 58 | 2 | 1; # End of Test::Pcuke::Executor::StepFailure | |||||||||||
| 59 | __END__ | ||||||||||||