| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::Object::Role::Throwable; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
33913
|
use 5.014; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
22
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
39
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use routines; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
2283
|
use Moo::Role; |
|
|
1
|
|
|
|
|
9945
|
|
|
|
1
|
|
|
|
|
6
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '2.01'; # VERSION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# METHODS |
|
14
|
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
1
|
52114
|
method throw(@args) { |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
4
|
|
|
16
|
2
|
|
|
|
|
1259
|
require Data::Object::Exception; |
|
17
|
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
4896
|
my $class = 'Data::Object::Exception'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
9
|
@args = ($args[0], $self, @args[1..$#args]); |
|
21
|
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
8
|
@_ = ($class, @args); |
|
23
|
|
|
|
|
|
|
|
|
24
|
2
|
|
|
|
|
19
|
goto $class->can('throw'); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=encoding utf8 |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Data::Object::Role::Throwable |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 ABSTRACT |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Throwable Role for Perl 5 |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
package Example; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Moo; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
with 'Data::Object::Role::Throwable'; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
package main; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $example = Example->new; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# $example->throw |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This package provides mechanisms for throwing the object as an exception. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 METHODS |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This package implements the following methods: |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 throw |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
throw(Tuple[Str, Str] | Str $message, Maybe[Number] $offset) : Any |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The throw method throws an exception with the object and the given message. The |
|
76
|
|
|
|
|
|
|
object is thrown as the exception context. See L<Data::Object::Exception> for |
|
77
|
|
|
|
|
|
|
more information. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=over 4 |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item throw example #1 |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# given: synopsis |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$example->throw('Oops!'); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=over 4 |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item throw example #2 |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# given: synopsis |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
$example->throw(['E001', 'Oops!']); |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Al Newkirk, C<awncorp@cpan.org> |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 LICENSE |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Copyright (C) 2011-2019, Al Newkirk, et al. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the terms |
|
110
|
|
|
|
|
|
|
of the The Apache License, Version 2.0, as elucidated in the L<"license |
|
111
|
|
|
|
|
|
|
file"|https://github.com/iamalnewkirk/data-object-role-throwable/blob/master/LICENSE>. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 PROJECT |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
L<Wiki|https://github.com/iamalnewkirk/data-object-role-throwable/wiki> |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L<Project|https://github.com/iamalnewkirk/data-object-role-throwable> |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
L<Initiatives|https://github.com/iamalnewkirk/data-object-role-throwable/projects> |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<Milestones|https://github.com/iamalnewkirk/data-object-role-throwable/milestones> |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
L<Contributing|https://github.com/iamalnewkirk/data-object-role-throwable/blob/master/CONTRIBUTE.md> |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L<Issues|https://github.com/iamalnewkirk/data-object-role-throwable/issues> |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |