| 1 | package Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 44 | ▶ | use 5.018; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 44 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 44 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | # IMPORTS | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 44 | ▶ | use Venus::Class 'attr', 'base', 'with'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | # INHERITS | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 44 | base 'Venus::Kind::Utility'; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # INTEGRATES | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 44 | with 'Venus::Role::Encaseable'; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 44 | with 'Venus::Role::Explainable'; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | # OVERLOADS | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 44 | ▶ | use overload ( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | '""' => 'explain', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | 'eq' => sub{$_[0]->render eq "$_[1]"}, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | 'ne' => sub{$_[0]->render ne "$_[1]"}, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | 'qr' => sub{qr/@{[quotemeta($_[0]->render)]}/}, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 44 | '~~' => 'explain', | |||||||||||||||||||||||||||||||||||||||||
| 29 | fallback => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 44 | ); | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | # ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 44 | attr 'name'; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 44 | attr 'cause'; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 44 | attr 'context'; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 44 | attr 'message'; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 44 | attr 'offset'; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 44 | attr 'verbose'; | |||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | # BUILDERS | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 9 | ▶ | sub build_arg { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_arg: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 9 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 9 | message => $data, | |||||||||||||||||||||||||||||||||||||||||
| 48 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 608 | ▶ | sub build_self { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_self: called CC=10 SCAR=24.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 608 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 608 | ▶ | if ($data->{name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | $self->name($data->{name}); | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 608 | ▶ | if (!$self->context) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 608 | $self->context('N/A'); | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 608 | ▶ | if (!$self->message) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 595 | $self->message('Exception!'); | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 608 | ▶ | if (!exists $data->{verbose}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 607 | ▶ | $self->verbose($ENV{VENUS_ERROR_VERBOSE} // 1); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{"VENUS_ERROR_VERBOSE"} // 1
MC/DC0%0/1
$ENV{"VENUS_ERROR_VERBOSE"} // 1
$ENV{"VENUS_ERROR_VERBOSE"}
Truth table50%1/2
A
A= $ENV{"VENUS_ERROR_VERBOSE"}
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 608 | ▶ | if (!exists $data->{offset}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 607 | ▶ | $self->offset($ENV{VENUS_ERROR_TRACE_OFFSET} // 2); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{"VENUS_ERROR_TRACE_OFFSET"} // 2
MC/DC0%0/1
$ENV{"VENUS_ERROR_TRACE_OFFSET"} // 2
$ENV{"VENUS_ERROR_TRACE_OFFSET"}
Truth table50%1/2
A
A= $ENV{"VENUS_ERROR_TRACE_OFFSET"}
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 608 | ▶ | if (!@{$self->frames}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 608 | $self->trace($self->offset); | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 608 | ▶ | if (my $stash = delete $data->{stash}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | %{$self->stash} = %{$stash}; | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 608 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | # METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 3 | ▶ | sub arguments { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
arguments: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 3 | my ($self, $index) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | my $captured = $self->captured; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 3 | ▶ | return undef if !$captured; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | my $arguments = $captured->{arguments}; | |||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | ▶ | return $arguments if !defined $index; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | ▶ | return undef if !$arguments; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | return $arguments->[$index]; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 16 | ▶ | sub as { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 16 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 16 | $name = $self->id($name); | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 16 | my $method = $self->method('as', $name); | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 16 | ▶ | $self = ref $self ? $self : $self->new; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 16 | ▶ | return $self->do('name', $name) if !$self->can($method); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 8 | return $self->$method; | |||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 3 | ▶ | sub callframe { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callframe: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 3 | my ($self, $index) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | my $captured = $self->captured; | |||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 3 | ▶ | return undef if !$captured; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | my $callframe = $captured->{callframe}; | |||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | ▶ | return $callframe if !defined $index; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | ▶ | return undef if !$callframe; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 1 | return $callframe->[$index]; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 211 | ▶ | sub capture { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
capture: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 211 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 211 | ▶ | $self->stash(captured => { | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->offset // 0
MC/DC100%1/1
$self->offset // 0
$self->offset
Truth table100%2/2
A
A= $self->offset
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | callframe => [caller($self->offset // 0)], | ||||||||||||||||||||||||||||||||||||||||||
| 138 | arguments => [@args], | ||||||||||||||||||||||||||||||||||||||||||
| 139 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 211 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 7 | ▶ | sub captured { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
captured: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 7 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 7 | my $captured = $self->stash->{captured}; | |||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 7 | return $captured; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 507 | ▶ | sub copy { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
copy: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 507 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 507 | ▶ | if (!$data->isa('Venus::Error')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 507 | ▶ | if ($data->name) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 28 | $self->name($data->name) | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 507 | ▶ | if ($data->context) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 507 | $self->context($data->context) | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 507 | ▶ | if ($data->message) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 26 | $self->message($data->message) | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 507 | ▶ | if (defined $data->verbose) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 5 | $self->verbose($data->verbose) | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 507 | ▶ | if (@{$data->frames}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | $self->recase('frames', $data->frames) | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 507 | ▶ | if (my $stash = $data->stash) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 507 | %{$self->stash} = (%{$self->stash}, %{$stash}); | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 507 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 1237 | ▶ | sub explain { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
explain: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 1237 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 1237 | ▶ | $self->trace(1, 1) if !@{$self->frames}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 1237 | my $frames = $self->frames; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 1237 | my $message = $self->render; | |||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 1237 | my @stacktrace = "$message" =~ s/^\s+|\s+$//gr; | |||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 1237 | ▶ | return join "\n", @stacktrace, "" if !$self->verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 1232 | ▶ | push @stacktrace, 'Name:', $self->name || 'N/A'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->name || 'N/A'
MC/DC100%1/1
$self->name || 'N/A'
$self->name
Truth table100%2/2
A
A= $self->name
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 1232 | push @stacktrace, 'Type:', ref($self); | |||||||||||||||||||||||||||||||||||||||||
| 200 | 1232 | ▶ | push @stacktrace, 'Context:', $self->context || 'N/A'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->context || 'N/A'
MC/DC0%0/1
$self->context || 'N/A'
$self->context
Truth table50%1/2
A
A= $self->context
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 44 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 1232 | require Data::Dumper; | |||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 1232 | local $Data::Dumper::Indent = 1; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 1232 | local $Data::Dumper::Trailingcomma = 0; | |||||||||||||||||||||||||||||||||||||||||
| 208 | 1232 | local $Data::Dumper::Purity = 0; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 1232 | local $Data::Dumper::Pad = ''; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 1232 | local $Data::Dumper::Varname = 'VAR'; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 1232 | local $Data::Dumper::Useqq = 0; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 1232 | local $Data::Dumper::Terse = 1; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 1232 | local $Data::Dumper::Freezer = ''; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 1232 | local $Data::Dumper::Toaster = ''; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 1232 | local $Data::Dumper::Deepcopy = 1; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 1232 | local $Data::Dumper::Quotekeys = 0; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 1232 | local $Data::Dumper::Bless = 'bless'; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 1232 | local $Data::Dumper::Pair = ' => '; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 1232 | local $Data::Dumper::Maxdepth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 1232 | local $Data::Dumper::Maxrecurse = 1000; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 1232 | local $Data::Dumper::Useperl = 0; | |||||||||||||||||||||||||||||||||||||||||
| 222 | 1232 | local $Data::Dumper::Sortkeys = 1; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 1232 | local $Data::Dumper::Deparse = 1; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 1232 | local $Data::Dumper::Sparseseen = 0; | |||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 1232 | my $stashed = Data::Dumper->Dump([$self->stash]); | |||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 1232 | $stashed =~ s/^'|'$//g; | |||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 1232 | chomp $stashed; | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 1232 | push @stacktrace, 'Stashed:', $stashed; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 1232 | ▶ | push @stacktrace, 'Traceback (reverse chronological order):' if @$frames > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 44 | ▶ | use warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 1232 | @stacktrace = (join("\n\n", grep defined, @stacktrace), ''); | |||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 1232 | ▶ | for (my $i = 1; $i < @$frames; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 23720 | my $pack = $frames->[$i][0]; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 23720 | my $file = $frames->[$i][1]; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 23720 | my $line = $frames->[$i][2]; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 23720 | my $subr = $frames->[$i][3]; | |||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 23720 | push @stacktrace, "$subr\n in $file at line $line"; | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 1232 | my $cause = $self->cause; | |||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | 1232 | ▶ | if ($cause) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 23 | $cause = join("\n", "", "Cause:\n", "$cause"); | |||||||||||||||||||||||||||||||||||||||||
| 252 | 23 | chomp $cause; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 23 | push @stacktrace, $cause; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 1232 | return join "\n", @stacktrace, ""; | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 2 | ▶ | sub frame { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
frame: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | 2 | my ($self, $index) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 2 | my $frames = $self->frames; | |||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 2 | ▶ | $index //= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$index //= 0
MC/DC100%1/1
$index //= 0
$index
Truth table100%2/2
A
A= $index
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 2 | package => $frames->[$index][0], | |||||||||||||||||||||||||||||||||||||||||
| 268 | filename => $frames->[$index][1], | ||||||||||||||||||||||||||||||||||||||||||
| 269 | line => $frames->[$index][2], | ||||||||||||||||||||||||||||||||||||||||||
| 270 | subroutine => $frames->[$index][3], | ||||||||||||||||||||||||||||||||||||||||||
| 271 | hasargs => $frames->[$index][4], | ||||||||||||||||||||||||||||||||||||||||||
| 272 | wantarray => $frames->[$index][5], | ||||||||||||||||||||||||||||||||||||||||||
| 273 | evaltext => $frames->[$index][6], | ||||||||||||||||||||||||||||||||||||||||||
| 274 | is_require => $frames->[$index][7], | ||||||||||||||||||||||||||||||||||||||||||
| 275 | hints => $frames->[$index][8], | ||||||||||||||||||||||||||||||||||||||||||
| 276 | bitmask => $frames->[$index][9], | ||||||||||||||||||||||||||||||||||||||||||
| 277 | hinthash => $frames->[$index][10], | ||||||||||||||||||||||||||||||||||||||||||
| 278 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 4475 | ▶ | sub frames { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
frames: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 4475 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 4475 | return $self->encase('frames', []); | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 3 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 3 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 3 | @args = map $self->$_, @args; | |||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 3 | ▶ | return wantarray ? (@args) : $args[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 400 | ▶ | sub id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
id: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 400 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 400 | my $name = join '.', grep defined, @args; | |||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 400 | ▶ | $name = lc $name =~ s/\W+/./gr if $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 400 | return $name; | |||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 54 | ▶ | sub input { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
input: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 54 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 54 | ▶ | $self->stash(input => { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->offset // 0
MC/DC0%0/1
$self->offset // 0
$self->offset
Truth table50%1/2
A
A= $self->offset
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | callframe => [caller($self->offset // 0)], | ||||||||||||||||||||||||||||||||||||||||||
| 310 | arguments => [@args], | ||||||||||||||||||||||||||||||||||||||||||
| 311 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 54 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | 18 | ▶ | sub is { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is: called CC=8 SCAR=21.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 18 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 18 | $name = $self->id($name); | |||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 18 | my $method = $self->method('is', $name); | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | 18 | ▶ | return false if !$self->name && !$self->can($method); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->name or $self->can($method)
MC/DC0%0/2
$self->name or $self->can($method)
$self->name
$self->can($method)
Truth table66%2/3
A or B
A= $self->nameB= $self->can($method)
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 18 | ▶ | return $self->name eq $name ? true : false if $self->name && !$self->can($method); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$self->name and not $self->can($method)
MC/DC50%1/2
$self->name and not $self->can($method)
$self->name
not $self->can($method)
Truth table66%2/3
A and not(B)
A= $self->nameB= not $self->can($method)
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 3 | ▶ | return (ref $self ? $self: $self->new)->$method ? true : false; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub label { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
label: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | $name = lc $name =~ s/\W/_/gr if $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | return $name; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 51 | ▶ | sub method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 51 | my ($self, @name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 51 | @name = map {lc s/\W/_/gr} @name; | |||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 51 | return join '_', @name; | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | 2338 | ▶ | sub name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=3 SCAR=11.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 2338 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 2338 | ▶ | return $self->ITEM('name', defined $name ? $self->id($name) || () : ()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->id($name) or ()
MC/DC0%0/2
$self->id($name) or ()
$self->id($name)
()
Truth table33%1/3
A or B
A= $self->id($name)B= ()
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | 17 | ▶ | sub of { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
of: called CC=8 SCAR=27.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | 17 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 17 | $name = $self->id($name); | |||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 17 | my $method = $self->method('of', $name); | |||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 17 | ▶ | return false if !$self->name && !$self->can($method); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->name or $self->can($method)
MC/DC0%0/2
$self->name or $self->can($method)
$self->name
$self->can($method)
Truth table33%1/3
A or B
A= $self->nameB= $self->can($method)
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | 17 | ▶ | return $self->name =~ /$name/ ? true : false if $self->name && !$self->can($method); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$self->name and not $self->can($method)
MC/DC0%0/2
$self->name and not $self->can($method)
$self->name
not $self->can($method)
Truth table33%1/3
A and not(B)
A= $self->nameB= not $self->can($method)
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | return (ref $self ? $self: $self->new)->$method ? true : false; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 1 | ▶ | sub on { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on: called CC=7 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 1 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | ▶ | $self = ref $self ? $self : $self->new; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | ▶ | $name ||= (split(/::/, (caller($self->offset // 0))[3]))[-1]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition20%1/5
$name ||= (split(/::/u, (caller($self->offset // 0))[3], 0))[-1]
$self->offset // 0
MC/DC0%0/2
$name ||= (split(/::/u, (caller($self->offset // 0))[3], 0))[-1]
$name
(split(/::/u, (caller($self->offset // 0))[3], 0))[-1]
MC/DC0%0/1
$self->offset // 0
$self->offset
Truth table33%1/3
A ||= B
A= $nameB= (split(/::/u, (caller($self->offset // 0))[3], 0))[-1]
Truth table0%0/2
A
A= $self->offset
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 1 | ▶ | $self->name($self->id('on', $name)) if $name && $name ne '__ANON__' && $name ne '(eval)'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$name and $name ne "__ANON__" and $name ne "(eval)"
$name and $name ne "__ANON__"
MC/DC0%0/3
$name and $name ne "__ANON__" and $name ne "(eval)"
$name
$name ne "__ANON__"
$name ne "(eval)"
Truth table25%1/4
A and B and C
A= $nameB= $name ne "__ANON__"C= $name ne "(eval)"
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 44 | ▶ | sub output { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 44 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 44 | ▶ | $self->stash(output => { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->offset // 0
MC/DC0%0/1
$self->offset // 0
$self->offset
Truth table50%1/2
A
A= $self->offset
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | callframe => [caller($self->offset // 0)], | ||||||||||||||||||||||||||||||||||||||||||
| 383 | arguments => [@args], | ||||||||||||||||||||||||||||||||||||||||||
| 384 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 44 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 1343 | ▶ | sub render { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 1343 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 1343 | my $message = $self->message; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 1343 | my $stashed = $self->stash; | |||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | 1343 | ▶ | while (my($key, $value) = each(%$stashed)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 8491 | ▶ | next if !defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 8439 | my $token = quotemeta $key; | |||||||||||||||||||||||||||||||||||||||||
| 398 | 8439 | $message =~ s/\{\{\s*$token\s*\}\}/$value/g; | |||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 1343 | return $message; | |||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 265 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=7 SCAR=24.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 265 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 265 | ▶ | $self->verbose($ENV{VENUS_ERROR_VERBOSE} // 1) if !defined $self->verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$ENV{"VENUS_ERROR_VERBOSE"} // 1
MC/DC0%0/1
$ENV{"VENUS_ERROR_VERBOSE"} // 1
$ENV{"VENUS_ERROR_VERBOSE"}
Truth table0%0/2
A
A= $ENV{"VENUS_ERROR_VERBOSE"}
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 265 | ▶ | $self->offset($ENV{VENUS_ERROR_TRACE_OFFSET} // 1) if !defined $self->offset; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$ENV{"VENUS_ERROR_TRACE_OFFSET"} // 1
MC/DC0%0/1
$ENV{"VENUS_ERROR_TRACE_OFFSET"} // 1
$ENV{"VENUS_ERROR_TRACE_OFFSET"}
Truth table0%0/2
A
A= $ENV{"VENUS_ERROR_TRACE_OFFSET"}
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | 265 | ▶ | $self->context((caller(($self->offset // 0) + 1))[3]); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->offset // 0
MC/DC0%0/1
$self->offset // 0
$self->offset
Truth table50%1/2
A
A= $self->offset
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 265 | ▶ | $self->trace(($self->offset // 0) + 1); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->offset // 0
MC/DC0%0/1
$self->offset // 0
$self->offset
Truth table50%1/2
A
A= $self->offset
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 265 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | 8 | ▶ | sub set { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | 8 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | 8 | ▶ | if (@args > 2 && not @args % 2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@args > 2 and not @args % 2
MC/DC50%1/2
@args > 2 and not @args % 2
@args > 2
not @args % 2
Truth table66%2/3
A and not(B)
A= @args > 2B= not @args % 2
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | 1 | my %data = @args; | |||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | 1 | $self->$_($data{$_}) for keys %data; | |||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | 7 | ▶ | if (@args > 0 && ref $args[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@args > 0 and ref $args[0] eq "HASH"
MC/DC50%1/2
@args > 0 and ref $args[0] eq "HASH"
@args > 0
ref $args[0] eq "HASH"
Truth table66%2/3
A and B
A= @args > 0B= ref $args[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | 1 | my %data = %{$args[0]}; | |||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 1 | $self->$_($data{$_}) for keys %data; | |||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 6 | my ($key, @value) = @args; | |||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 6 | $self->$key(@value); | |||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 6 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | 8090 | ▶ | sub stash { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stash: called CC=10 SCAR=23.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | 8090 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | 8090 | ▶ | if (@args > 2 && not @args % 2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@args > 2 and not @args % 2
MC/DC50%1/2
@args > 2 and not @args % 2
@args > 2
not @args % 2
Truth table66%2/3
A and not(B)
A= @args > 2B= not @args % 2
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 1 | my %data = @args; | |||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | 1 | $self->stash($_, $data{$_}) for keys %data; | |||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | 1 | return $self->stash; | |||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | 8089 | ▶ | if (@args > 0 && ref $args[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args > 0 and ref $args[0] eq "HASH"
MC/DC100%2/2
@args > 0 and ref $args[0] eq "HASH"
@args > 0
ref $args[0] eq "HASH"
Truth table100%3/3
A and B
A= @args > 0B= ref $args[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 456 | 272 | my %data = %{$args[0]}; | |||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | 272 | ▶ | if (!%data) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | return $self->recase('stashed', {}); | |||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 272 | $self->stash($_, $data{$_}) for keys %data; | |||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 272 | return $self->stash; | |||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 7817 | my ($key, @value) = @args; | |||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | 7817 | my $stashed = $self->encase('stashed', {}); | |||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | 7817 | ▶ | return $stashed if !defined $key; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | 3440 | ▶ | return $stashed->{$key} if !@value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 3374 | my $value = $stashed->{$key} = $value[0]; | |||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 3374 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | 264 | ▶ | sub sysinfo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sysinfo: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 481 | 264 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | 264 | $self->system_name; | |||||||||||||||||||||||||||||||||||||||||
| 484 | 264 | $self->system_path; | |||||||||||||||||||||||||||||||||||||||||
| 485 | 264 | $self->system_perl_path; | |||||||||||||||||||||||||||||||||||||||||
| 486 | 264 | $self->system_perl_version; | |||||||||||||||||||||||||||||||||||||||||
| 487 | 264 | $self->system_process_id; | |||||||||||||||||||||||||||||||||||||||||
| 488 | 264 | $self->system_script_args; | |||||||||||||||||||||||||||||||||||||||||
| 489 | 264 | $self->system_script_path; | |||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | 264 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 266 | ▶ | sub system_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system_name: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | 266 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | 266 | ▶ | $self->stash('system_name', @args ? $args[0] : $^O); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | 266 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | 266 | ▶ | sub system_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system_path: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 503 | 266 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | 266 | require Cwd; | |||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | 266 | ▶ | $self->stash('system_path', @args ? $args[0] : Cwd->getcwd); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | 266 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | 266 | ▶ | sub system_perl_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system_perl_path: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | 266 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 266 | ▶ | $self->stash('system_perl_path', @args ? $args[0] : $^X); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | 266 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | 266 | ▶ | sub system_perl_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system_perl_version: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | 266 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | 266 | ▶ | $self->stash('system_perl_version', @args ? $args[0] : "$^V"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | 266 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | 266 | ▶ | sub system_process_id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system_process_id: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | 266 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | 266 | ▶ | $self->stash('system_process_id', @args ? $args[0] : $$); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 266 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||
| 536 | 266 | ▶ | sub system_script_args { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system_script_args: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 537 | 266 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | 266 | ▶ | $self->stash('system_script_args', @args ? [@args] : [@ARGV]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | 266 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | 266 | ▶ | sub system_script_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system_script_path: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | 266 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | 266 | ▶ | $self->stash('system_script_path', @args ? $args[0] : $0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | 266 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | 876 | ▶ | sub trace { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trace: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 553 | 876 | my ($self, $offset, $limit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | 876 | my $frames = $self->frames; | |||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | 876 | @$frames = (); | |||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | 876 | ▶ | for (my $i = $offset // $self->offset; my @caller = caller($i); $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$offset // $self->offset
MC/DC0%0/2
$offset // $self->offset
$offset
$self->offset
Truth table66%2/3
A // B
A= $offsetB= $self->offset
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | 18221 | push @$frames, [@caller]; | |||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||
| 562 | 18221 | ▶ | last if defined $limit && $i + 1 == $offset + $limit; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $limit and $i + 1 == $offset + $limit
MC/DC100%2/2
defined $limit and $i + 1 == $offset + $limit
defined $limit
$i + 1 == $offset + $limit
Truth table100%3/3
A and B
A= defined $limitB= $i + 1 == $offset + $limit
| |||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | 876 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 500 | ▶ | sub throw { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
throw: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | 500 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | 500 | ▶ | $self = $self->new(@args) if !ref $self; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | 500 | die $self; | |||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 44 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||
| 582 | Venus::Error - Error Class | ||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||
| 584 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | =head1 ABSTRACT | ||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | Error Class for Perl 5 | ||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||
| 590 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||
| 596 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||
| 598 | my $error = Venus::Error->new; | ||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||
| 600 | # $error->throw; | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | This package represents a context-aware error (exception object). The default | ||||||||||||||||||||||||||||||||||||||||||
| 607 | for error verbosity can be controlled via the C<VENUS_ERROR_VERBOSE> | ||||||||||||||||||||||||||||||||||||||||||
| 608 | environment variable, e.g. a setting of C<0> disables stack traces. The default | ||||||||||||||||||||||||||||||||||||||||||
| 609 | trace-offset can be controlled via the C<VENUS_ERROR_TRACE_OFFSET> environment | ||||||||||||||||||||||||||||||||||||||||||
| 610 | variable, e.g. a setting of C<0> indicates no offset. | ||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||
| 614 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | This package has the following attributes: | ||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||
| 620 | =head2 name | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | name(string $name) (string) | ||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||
| 624 | The name attribute is read-write, accepts C<string> values, and is optional. | ||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | I<Since C<0.01>> | ||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||
| 630 | =item name example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||
| 634 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | my $set_name = $error->name("on.save"); | ||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | # "on.save" | ||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||
| 642 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||
| 644 | =item name example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||
| 646 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||
| 648 | # given: example-1 name | ||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||
| 652 | my $get_name = $error->name; | ||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||
| 654 | # "on.save" | ||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||
| 660 | =head2 cause | ||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | cause(Venus::Error $error) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||
| 664 | The cause attribute is read-write, accepts C<Venus::Error> values, and is | ||||||||||||||||||||||||||||||||||||||||||
| 665 | optional. | ||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||
| 669 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||
| 671 | =item cause example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||
| 673 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||
| 675 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||
| 677 | my $set_cause = $error->cause(Venus::Error->new); | ||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||
| 679 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||
| 683 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | =item cause example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | # given: example-1 cause | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | my $get_cause = $error->cause; | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||
| 697 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | =head2 context | ||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||
| 703 | context(string $context) (string) | ||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | The context attribute is read-write, accepts C<string> values, and is optional. | ||||||||||||||||||||||||||||||||||||||||||
| 706 | Defaults to C<'N/A'>. | ||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | I<Since C<0.01>> | ||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||
| 710 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||
| 712 | =item context example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||
| 716 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | my $set_context = $error->context("main::main"); | ||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | # "main::main" | ||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||
| 724 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||
| 726 | =item context example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||
| 728 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | # given: example-1 context | ||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||
| 732 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||
| 734 | my $get_context = $error->context; | ||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | # "main::main" | ||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||
| 740 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||
| 742 | =head2 message | ||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | message(string $message) (string) | ||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | The message attribute is read-write, accepts C<string> values, and is optional. | ||||||||||||||||||||||||||||||||||||||||||
| 747 | Defaults to C<'Exception!'>. | ||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||
| 749 | I<Since C<0.01>> | ||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||
| 751 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||
| 753 | =item message example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||
| 755 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||
| 759 | my $set_message = $error->message("Exception!"); | ||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | # "Exception!" | ||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||
| 763 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||
| 765 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||
| 767 | =item message example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | # given: example-1 message | ||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||
| 773 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||
| 775 | my $get_message = $error->message; | ||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||
| 777 | # "Exception!" | ||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||
| 781 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | =head2 verbose | ||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||
| 785 | verbose(number $verbose) (number) | ||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | The verbose attribute is read-write, accepts C<number> values, and is optional. | ||||||||||||||||||||||||||||||||||||||||||
| 788 | Defaults to C<true>. | ||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||
| 790 | I<Since C<0.01>> | ||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||
| 792 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||
| 794 | =item verbose example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||
| 796 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||||||||||
| 800 | my $set_verbose = $error->verbose(true); | ||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||
| 802 | # true | ||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||
| 806 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||
| 808 | =item verbose example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||
| 810 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||
| 812 | # given: example-1 verbose | ||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||
| 814 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||
| 816 | my $get_verbose = $error->verbose; | ||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||
| 818 | # true | ||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||
| 820 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||
| 822 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | =head1 INHERITS | ||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||
| 826 | This package inherits behaviors from: | ||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||
| 828 | L<Venus::Kind::Utility> | ||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||
| 830 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||
| 832 | =head1 INTEGRATES | ||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||
| 834 | This package integrates behaviors from: | ||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||
| 836 | L<Venus::Role::Explainable> | ||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||
| 838 | L<Venus::Role::Encaseable> | ||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||
| 840 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||
| 842 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | This package provides the following methods: | ||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||
| 846 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||
| 848 | =head2 arguments | ||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||
| 850 | arguments(number $index) (any) | ||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||
| 852 | The arguments method returns the stashed arguments under L</captured>, or a | ||||||||||||||||||||||||||||||||||||||||||
| 853 | specific argument if an index is provided. | ||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | I<Since C<2.55>> | ||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||
| 857 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||
| 859 | =item arguments example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||
| 861 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||
| 863 | my $arguments = $error->arguments; | ||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||
| 865 | # undef | ||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||
| 867 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||
| 869 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||
| 871 | =item arguments example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||
| 875 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||
| 877 | my $error = Venus::Error->new->capture(1..4); | ||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||
| 879 | my $arguments = $error->arguments; | ||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||
| 881 | # [1..4] | ||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||
| 885 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||
| 887 | =item arguments example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||
| 889 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||
| 891 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | my $error = Venus::Error->new->capture(1..4); | ||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||
| 895 | my $arguments = $error->arguments(0); | ||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||
| 897 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||
| 901 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||
| 903 | =head2 as | ||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||
| 905 | as(string $name) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||
| 907 | The as method returns an error object using the return value(s) of the "as" | ||||||||||||||||||||||||||||||||||||||||||
| 908 | method specified, which should be defined as C<"as_${name}">, which will be | ||||||||||||||||||||||||||||||||||||||||||
| 909 | called automatically by this method. If no C<"as_${name}"> method exists, this | ||||||||||||||||||||||||||||||||||||||||||
| 910 | method will set the L</name> attribute to the value provided. | ||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||
| 912 | I<Since C<1.02>> | ||||||||||||||||||||||||||||||||||||||||||
| 913 | |||||||||||||||||||||||||||||||||||||||||||
| 914 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||
| 916 | =item as example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||
| 918 | package System::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||
| 920 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||
| 922 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||
| 924 | sub as_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 925 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||
| 927 | return $self->do('message', 'auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||
| 930 | sub as_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 931 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | return $self->do('message', 'role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||
| 936 | sub is_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 937 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||
| 939 | return $self->message eq 'auth_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 940 | } | ||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||
| 942 | sub is_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 943 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||
| 945 | return $self->message eq 'role_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 946 | } | ||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||
| 948 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||
| 950 | my $error = System::Error->new->as('auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||
| 952 | $error->throw; | ||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||
| 954 | # Exception! (isa Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||
| 958 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||
| 960 | =item as example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||
| 962 | package System::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||
| 964 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||
| 966 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||
| 968 | sub as_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 969 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||
| 971 | return $self->do('message', 'auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 972 | } | ||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||
| 974 | sub as_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 975 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||
| 977 | return $self->do('message', 'role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||
| 980 | sub is_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 981 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||
| 983 | return $self->message eq 'auth_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 984 | } | ||||||||||||||||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||||||||||||||||
| 986 | sub is_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 987 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||||
| 989 | return $self->message eq 'role_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||
| 992 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||
| 994 | my $error = System::Error->new->as('role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||
| 996 | $error->throw; | ||||||||||||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||||||||||||
| 998 | # Exception! (isa Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||
| 1000 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||
| 1002 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||
| 1004 | =item as example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||
| 1006 | package Virtual::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||
| 1008 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||
| 1010 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||
| 1012 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||
| 1014 | my $error = Virtual::Error->new->as('on_save_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||
| 1016 | $error->throw; | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||
| 1018 | # name is "on_save_error" | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||
| 1020 | # Exception! (isa Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||
| 1024 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | =item as example 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||
| 1028 | package Virtual::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||
| 1030 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||
| 1032 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||
| 1034 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||
| 1036 | my $error = Virtual::Error->new->as('on.SAVE.error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||||||||||||
| 1038 | $error->throw; | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||
| 1040 | # name is "on_save_error" | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||
| 1042 | # Exception! (isa Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||||||||||||
| 1044 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||||||||||||||||
| 1046 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||
| 1048 | =head2 callframe | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||
| 1050 | callframe(number $index) (any) | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||
| 1052 | The callframe method returns the stashed callframe under L</captured>, or a | ||||||||||||||||||||||||||||||||||||||||||
| 1053 | specific argument if an index is provided. | ||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||
| 1055 | I<Since C<2.55>> | ||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||
| 1057 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||
| 1059 | =item callframe example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||||||||||||||||
| 1061 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||
| 1063 | my $callframe = $error->callframe; | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||
| 1065 | # undef | ||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||
| 1067 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||
| 1069 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||
| 1071 | =item callframe example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||||||||||||||||
| 1073 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||||||||||||||||
| 1075 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | my $error = Venus::Error->new->do('offset', 0)->capture; | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||
| 1079 | my $callframe = $error->callframe; | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||
| 1081 | # [...] | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||
| 1083 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||
| 1085 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||
| 1087 | =item callframe example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||
| 1089 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||
| 1091 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||
| 1093 | my $error = Venus::Error->new->do('offset', 0)->capture; | ||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||
| 1095 | my $package = $error->callframe(0); | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||
| 1097 | # 'main' | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | |||||||||||||||||||||||||||||||||||||||||||
| 1099 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||||||||||||||||
| 1101 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||
| 1103 | =head2 capture | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||||||||||||||||
| 1105 | capture(any @args) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||
| 1107 | The capture method captures the L<caller> info at the L</frame> specified, in | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | the object stash, and returns the invocant. | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||||||||||||
| 1110 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||
| 1112 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||||||||||||||||
| 1114 | =item capture example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||||||||||||||||
| 1116 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||||||||||||
| 1118 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||
| 1120 | $error = $error->capture; | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||
| 1122 | # bless({...}, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||
| 1124 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||
| 1126 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||||||||||||||||
| 1128 | =head2 captured | ||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||
| 1130 | captured() (hashref) | ||||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||
| 1132 | The captured method returns the value stashed as C<"captured">. | ||||||||||||||||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||||||||||||||||
| 1134 | I<Since C<2.55>> | ||||||||||||||||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||||||||||||||||
| 1136 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1137 | |||||||||||||||||||||||||||||||||||||||||||
| 1138 | =item captured example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1139 | |||||||||||||||||||||||||||||||||||||||||||
| 1140 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||
| 1142 | my $captured = $error->captured; | ||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||
| 1144 | # undef | ||||||||||||||||||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||||||||||||||||
| 1146 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||
| 1148 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||
| 1150 | =head2 copy | ||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||
| 1152 | copy(Venus::Error $error) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||
| 1154 | The copy method copied the properties of the L<Venus::Error> provided into the | ||||||||||||||||||||||||||||||||||||||||||
| 1155 | invocant and returns the invocant. | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||||||||||||
| 1157 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||
| 1159 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||
| 1161 | =item copy example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||
| 1163 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||
| 1165 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||
| 1167 | my $oops = Venus::Error->as('on.oops'); | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||||||||||
| 1169 | my $copy = $error->copy($oops); | ||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||
| 1171 | # bless({ ... }, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||||||||||||
| 1173 | # $error->name; | ||||||||||||||||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||||||||||||||||
| 1175 | # "on.oops" | ||||||||||||||||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||||||||||||||||
| 1177 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||
| 1179 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||||||||||||||||
| 1181 | =item copy example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||
| 1183 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||
| 1185 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1186 | |||||||||||||||||||||||||||||||||||||||||||
| 1187 | my $oops = Venus::Error->as('on.oops'); | ||||||||||||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||||||||||||
| 1189 | $oops->message('Oops, something happened.'); | ||||||||||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||||||||||
| 1191 | $oops->stash(what => 'Unknown'); | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||
| 1193 | my $copy = $error->copy($oops); | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||
| 1195 | # bless({ ... }, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||
| 1197 | # $error->name; | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||
| 1199 | # "on.oops" | ||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||
| 1201 | # $error->message; | ||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||
| 1203 | # "Oops, something happened." | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||||||||||||||||
| 1205 | # $error->stash('what'); | ||||||||||||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||||||||||||
| 1207 | # "Unknown" | ||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||
| 1209 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||||||||||||||||
| 1211 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||
| 1213 | =head2 explain | ||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||
| 1215 | explain() (string) | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||
| 1217 | The explain method returns the error message and is used in stringification | ||||||||||||||||||||||||||||||||||||||||||
| 1218 | operations. | ||||||||||||||||||||||||||||||||||||||||||
| 1219 | |||||||||||||||||||||||||||||||||||||||||||
| 1220 | I<Since C<0.01>> | ||||||||||||||||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||||||||||||||||
| 1222 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||
| 1224 | =item explain example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||
| 1226 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||
| 1228 | $error->verbose(0); | ||||||||||||||||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||||||||||||||||
| 1230 | my $explain = $error->explain; | ||||||||||||||||||||||||||||||||||||||||||
| 1231 | |||||||||||||||||||||||||||||||||||||||||||
| 1232 | # "Exception!" in ... | ||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||
| 1234 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||||||||||||||||
| 1236 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||
| 1238 | =item explain example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||
| 1240 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||
| 1242 | $error->verbose(1); | ||||||||||||||||||||||||||||||||||||||||||
| 1243 | |||||||||||||||||||||||||||||||||||||||||||
| 1244 | my $explain = $error->explain; | ||||||||||||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||||||||||||
| 1246 | # "Exception!" in ... | ||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||
| 1248 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||||||||||||||||
| 1250 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||
| 1252 | =item explain example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||||||||||||
| 1254 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||||||||||||||||
| 1256 | $error->name('on.save.error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||
| 1258 | $error->verbose(1); | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||
| 1260 | my $explain = $error->explain; | ||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||
| 1262 | # "Exception!" in ... | ||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||
| 1264 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | |||||||||||||||||||||||||||||||||||||||||||
| 1266 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||
| 1268 | =item explain example 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||
| 1270 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||
| 1272 | $error->name('on.save.error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||
| 1274 | $error->stash('what', 'Unknown'); | ||||||||||||||||||||||||||||||||||||||||||
| 1275 | |||||||||||||||||||||||||||||||||||||||||||
| 1276 | $error->verbose(1); | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | my $explain = $error->explain; | ||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||
| 1280 | # "Exception!" in ... | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||
| 1282 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||
| 1284 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||||||||||||||||
| 1286 | =item explain example 5 | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||
| 1288 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||
| 1290 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||
| 1292 | my $step3 = Venus::Error->new( | ||||||||||||||||||||||||||||||||||||||||||
| 1293 | name => 'step3', | ||||||||||||||||||||||||||||||||||||||||||
| 1294 | message => 'Step 3: Failed', | ||||||||||||||||||||||||||||||||||||||||||
| 1295 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||
| 1297 | my $step2 = Venus::Error->new( | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | name => 'step2', | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | message => 'Step 2: Failed', | ||||||||||||||||||||||||||||||||||||||||||
| 1300 | cause => $step3, | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||
| 1303 | my $step1 = Venus::Error->new( | ||||||||||||||||||||||||||||||||||||||||||
| 1304 | name => 'step1', | ||||||||||||||||||||||||||||||||||||||||||
| 1305 | message => 'Step 1: Failed', | ||||||||||||||||||||||||||||||||||||||||||
| 1306 | cause => $step2, | ||||||||||||||||||||||||||||||||||||||||||
| 1307 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | my $explain = $step1->explain; | ||||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||
| 1311 | # "Step 1: Failed" in ... | ||||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||
| 1313 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1314 | |||||||||||||||||||||||||||||||||||||||||||
| 1315 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1316 | |||||||||||||||||||||||||||||||||||||||||||
| 1317 | =head2 frame | ||||||||||||||||||||||||||||||||||||||||||
| 1318 | |||||||||||||||||||||||||||||||||||||||||||
| 1319 | frame(number $index) (hashref) | ||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||
| 1321 | The frame method returns the data from C<caller> on the frames captured, and | ||||||||||||||||||||||||||||||||||||||||||
| 1322 | returns a hashref where the keys map to the keys described by | ||||||||||||||||||||||||||||||||||||||||||
| 1323 | L<perlfunc/caller>. | ||||||||||||||||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||||||||||||||||
| 1325 | I<Since C<1.11>> | ||||||||||||||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||||||||||||
| 1327 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||
| 1329 | =item frame example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||
| 1331 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||
| 1333 | my $frame = $error->frame; | ||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||
| 1335 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 1336 | # 'bitmask' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1337 | # 'evaltext' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1338 | # 'filename' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1339 | # 'hasargs' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | # 'hinthash' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1341 | # 'hints' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | # 'is_require' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1343 | # 'line' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1344 | # 'package' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1345 | # 'subroutine' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1346 | # 'wantarray' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1347 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||
| 1349 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||||||||||
| 1351 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||||||||||
| 1353 | =item frame example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||||||||||||||||
| 1357 | my $frame = $error->frame(1); | ||||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||
| 1359 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | # 'bitmask' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1361 | # 'evaltext' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | # 'filename' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | # 'hasargs' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1364 | # 'hinthash' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1365 | # 'hints' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1366 | # 'is_require' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1367 | # 'line' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1368 | # 'package' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1369 | # 'subroutine' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | # 'wantarray' => '...', | ||||||||||||||||||||||||||||||||||||||||||
| 1371 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||||||||||
| 1373 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||||||||||||||||
| 1375 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||
| 1377 | =head2 frames | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||||||||||||||||
| 1379 | frames() (arrayref) | ||||||||||||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||||||||||||
| 1381 | The frames method returns the compiled and stashed stack trace data. | ||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||
| 1383 | I<Since C<0.01>> | ||||||||||||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||||||||||
| 1385 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||
| 1387 | =item frames example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||||||||||||||||
| 1389 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||
| 1391 | my $frames = $error->frames; | ||||||||||||||||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||||||||||||||||
| 1393 | # [ | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 1395 | # [ | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | # "main", | ||||||||||||||||||||||||||||||||||||||||||
| 1397 | # "t/Venus_Error.t", | ||||||||||||||||||||||||||||||||||||||||||
| 1398 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 1399 | # ], | ||||||||||||||||||||||||||||||||||||||||||
| 1400 | # ] | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||
| 1402 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||||||||||||||||
| 1404 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||
| 1406 | =head2 get | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | |||||||||||||||||||||||||||||||||||||||||||
| 1408 | get(string @args) (any) | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | |||||||||||||||||||||||||||||||||||||||||||
| 1410 | The get method takes one or more attribute and/or method names and returns the | ||||||||||||||||||||||||||||||||||||||||||
| 1411 | result of calling each attribute and/or method. In scalar context returns a | ||||||||||||||||||||||||||||||||||||||||||
| 1412 | single value. In list context results a list of values. | ||||||||||||||||||||||||||||||||||||||||||
| 1413 | |||||||||||||||||||||||||||||||||||||||||||
| 1414 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 1415 | |||||||||||||||||||||||||||||||||||||||||||
| 1416 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||||||||||
| 1418 | =item get example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||||||||||||
| 1420 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||||||||||||
| 1422 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||
| 1424 | my $get = $error->get('verbose'); | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||||||||||||||||
| 1426 | # true | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | |||||||||||||||||||||||||||||||||||||||||||
| 1428 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1429 | |||||||||||||||||||||||||||||||||||||||||||
| 1430 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||||||||||||||||
| 1432 | =item get example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||
| 1434 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||||||||||||
| 1436 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||||||||||||
| 1438 | my $get = $error->get('verbose', 'context'); | ||||||||||||||||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||||||||||||||||
| 1440 | # true | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||
| 1442 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||
| 1444 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||
| 1446 | =item get example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||||||||||||||||
| 1448 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||
| 1450 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||||||||||||
| 1452 | my @get = $error->get('verbose', 'message'); | ||||||||||||||||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||||||||||||||||
| 1454 | # (true, 'Exception!') | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||
| 1456 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||||||||||||||||
| 1458 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||||||||||||||||
| 1460 | =head2 input | ||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||
| 1462 | input(any @args) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 1463 | |||||||||||||||||||||||||||||||||||||||||||
| 1464 | The input method captures the arguments provided as associates them with a | ||||||||||||||||||||||||||||||||||||||||||
| 1465 | L<"callframe"|perlfunc/caller> based on the level specified by L</offset>, in | ||||||||||||||||||||||||||||||||||||||||||
| 1466 | the object stash, and returns the invocant. | ||||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||
| 1468 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | |||||||||||||||||||||||||||||||||||||||||||
| 1470 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | |||||||||||||||||||||||||||||||||||||||||||
| 1472 | =item input example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||
| 1474 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1475 | |||||||||||||||||||||||||||||||||||||||||||
| 1476 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||||||||||
| 1478 | $error = $error->input(1..4); | ||||||||||||||||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||||||||||||||||
| 1480 | # bless({...}, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||||||||||||||||
| 1482 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||||||||||||||||
| 1484 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||
| 1486 | =head2 is | ||||||||||||||||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||||||||||||||||
| 1488 | is(string $name) (boolean) | ||||||||||||||||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||||||||||||||||
| 1490 | The is method returns truthy or falsy based on the return value(s) of the "is" | ||||||||||||||||||||||||||||||||||||||||||
| 1491 | method specified, which should be defined as C<"is_${name}">, which will be | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | called automatically by this method. If no C<"is_${name}"> method exists, this | ||||||||||||||||||||||||||||||||||||||||||
| 1493 | method will check if the L</name> attribute is equal to the value provided. | ||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||
| 1495 | I<Since C<1.02>> | ||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||
| 1497 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||
| 1499 | =item is example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||
| 1501 | package System::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||
| 1503 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||
| 1505 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||||||||||||||||
| 1507 | sub as_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1508 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1509 | |||||||||||||||||||||||||||||||||||||||||||
| 1510 | return $self->do('message', 'auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1511 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||||||||||||||||
| 1513 | sub as_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1514 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||||||||||||
| 1516 | return $self->do('message', 'role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1517 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1518 | |||||||||||||||||||||||||||||||||||||||||||
| 1519 | sub is_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1520 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||||||||||||||||
| 1522 | return $self->message eq 'auth_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1523 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||
| 1525 | sub is_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1526 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||
| 1528 | return $self->message eq 'role_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1529 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||||||||||||
| 1531 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||||||||||||||||
| 1533 | my $is = System::Error->new->as('auth_error')->is('auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||
| 1535 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1536 | |||||||||||||||||||||||||||||||||||||||||||
| 1537 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1538 | |||||||||||||||||||||||||||||||||||||||||||
| 1539 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1540 | |||||||||||||||||||||||||||||||||||||||||||
| 1541 | =item is example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||
| 1543 | package System::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1544 | |||||||||||||||||||||||||||||||||||||||||||
| 1545 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||||||||||||||||
| 1547 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||||||||||
| 1549 | sub as_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1550 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||
| 1552 | return $self->do('message', 'auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1553 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||
| 1555 | sub as_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1556 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||
| 1558 | return $self->do('message', 'role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1559 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||
| 1561 | sub is_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1562 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||
| 1564 | return $self->message eq 'auth_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||||||||||||
| 1567 | sub is_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1568 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1569 | |||||||||||||||||||||||||||||||||||||||||||
| 1570 | return $self->message eq 'role_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1571 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1572 | |||||||||||||||||||||||||||||||||||||||||||
| 1573 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1574 | |||||||||||||||||||||||||||||||||||||||||||
| 1575 | my $is = System::Error->as('auth_error')->is('auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||||||||||||
| 1577 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1578 | |||||||||||||||||||||||||||||||||||||||||||
| 1579 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1580 | |||||||||||||||||||||||||||||||||||||||||||
| 1581 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1582 | |||||||||||||||||||||||||||||||||||||||||||
| 1583 | =item is example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 1584 | |||||||||||||||||||||||||||||||||||||||||||
| 1585 | package System::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1586 | |||||||||||||||||||||||||||||||||||||||||||
| 1587 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||
| 1589 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1590 | |||||||||||||||||||||||||||||||||||||||||||
| 1591 | sub as_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1592 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1593 | |||||||||||||||||||||||||||||||||||||||||||
| 1594 | return $self->do('message', 'auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1595 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1596 | |||||||||||||||||||||||||||||||||||||||||||
| 1597 | sub as_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1598 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1599 | |||||||||||||||||||||||||||||||||||||||||||
| 1600 | return $self->do('message', 'role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1601 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||
| 1603 | sub is_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1604 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1605 | |||||||||||||||||||||||||||||||||||||||||||
| 1606 | return $self->message eq 'auth_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||||||||||||||||
| 1609 | sub is_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1611 | |||||||||||||||||||||||||||||||||||||||||||
| 1612 | return $self->message eq 'role_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1613 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||||||||||||||||
| 1615 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1616 | |||||||||||||||||||||||||||||||||||||||||||
| 1617 | my $is = System::Error->as('auth_error')->is('role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1618 | |||||||||||||||||||||||||||||||||||||||||||
| 1619 | # 0 | ||||||||||||||||||||||||||||||||||||||||||
| 1620 | |||||||||||||||||||||||||||||||||||||||||||
| 1621 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||||||||||||||||
| 1623 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1624 | |||||||||||||||||||||||||||||||||||||||||||
| 1625 | =item is example 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1626 | |||||||||||||||||||||||||||||||||||||||||||
| 1627 | package Virtual::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1628 | |||||||||||||||||||||||||||||||||||||||||||
| 1629 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1630 | |||||||||||||||||||||||||||||||||||||||||||
| 1631 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1632 | |||||||||||||||||||||||||||||||||||||||||||
| 1633 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1634 | |||||||||||||||||||||||||||||||||||||||||||
| 1635 | my $is = Virtual::Error->new->as('on_save_error')->is('on_save_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1636 | |||||||||||||||||||||||||||||||||||||||||||
| 1637 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1638 | |||||||||||||||||||||||||||||||||||||||||||
| 1639 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1640 | |||||||||||||||||||||||||||||||||||||||||||
| 1641 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1642 | |||||||||||||||||||||||||||||||||||||||||||
| 1643 | =item is example 5 | ||||||||||||||||||||||||||||||||||||||||||
| 1644 | |||||||||||||||||||||||||||||||||||||||||||
| 1645 | package Virtual::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1646 | |||||||||||||||||||||||||||||||||||||||||||
| 1647 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1648 | |||||||||||||||||||||||||||||||||||||||||||
| 1649 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1650 | |||||||||||||||||||||||||||||||||||||||||||
| 1651 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1652 | |||||||||||||||||||||||||||||||||||||||||||
| 1653 | my $is = Virtual::Error->new->as('on.SAVE.error')->is('on.save.error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1654 | |||||||||||||||||||||||||||||||||||||||||||
| 1655 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1656 | |||||||||||||||||||||||||||||||||||||||||||
| 1657 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1658 | |||||||||||||||||||||||||||||||||||||||||||
| 1659 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1660 | |||||||||||||||||||||||||||||||||||||||||||
| 1661 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||
| 1663 | new(any @args) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||
| 1665 | The new method constructs an instance of the package. | ||||||||||||||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||||||||||||
| 1667 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||
| 1669 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1670 | |||||||||||||||||||||||||||||||||||||||||||
| 1671 | =item new example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1672 | |||||||||||||||||||||||||||||||||||||||||||
| 1673 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1674 | |||||||||||||||||||||||||||||||||||||||||||
| 1675 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||
| 1677 | my $new = Venus::Error->new; | ||||||||||||||||||||||||||||||||||||||||||
| 1678 | |||||||||||||||||||||||||||||||||||||||||||
| 1679 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 1680 | |||||||||||||||||||||||||||||||||||||||||||
| 1681 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||||||||||||
| 1683 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1684 | |||||||||||||||||||||||||||||||||||||||||||
| 1685 | =item new example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||||||||||||
| 1687 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1688 | |||||||||||||||||||||||||||||||||||||||||||
| 1689 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1690 | |||||||||||||||||||||||||||||||||||||||||||
| 1691 | my $new = Venus::Error->new('Oops!'); | ||||||||||||||||||||||||||||||||||||||||||
| 1692 | |||||||||||||||||||||||||||||||||||||||||||
| 1693 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | |||||||||||||||||||||||||||||||||||||||||||
| 1695 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1696 | |||||||||||||||||||||||||||||||||||||||||||
| 1697 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1698 | |||||||||||||||||||||||||||||||||||||||||||
| 1699 | =item new example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 1700 | |||||||||||||||||||||||||||||||||||||||||||
| 1701 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||||||||||||||||
| 1703 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||||||||||||||||
| 1705 | my $new = Venus::Error->new(message => 'Oops!'); | ||||||||||||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||||||||||||
| 1707 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 1708 | |||||||||||||||||||||||||||||||||||||||||||
| 1709 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1710 | |||||||||||||||||||||||||||||||||||||||||||
| 1711 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1712 | |||||||||||||||||||||||||||||||||||||||||||
| 1713 | =head2 of | ||||||||||||||||||||||||||||||||||||||||||
| 1714 | |||||||||||||||||||||||||||||||||||||||||||
| 1715 | of(string $name) (boolean) | ||||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||
| 1717 | The of method returns truthy or falsy based on the return value(s) of the "of" | ||||||||||||||||||||||||||||||||||||||||||
| 1718 | method specified, which should be defined as C<"of_${name}">, which will be | ||||||||||||||||||||||||||||||||||||||||||
| 1719 | called automatically by this method. If no C<"of_${name}"> method exists, this | ||||||||||||||||||||||||||||||||||||||||||
| 1720 | method will check if the L</name> attribute contains the value provided. | ||||||||||||||||||||||||||||||||||||||||||
| 1721 | |||||||||||||||||||||||||||||||||||||||||||
| 1722 | I<Since C<1.11>> | ||||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||
| 1724 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1725 | |||||||||||||||||||||||||||||||||||||||||||
| 1726 | =item of example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1727 | |||||||||||||||||||||||||||||||||||||||||||
| 1728 | package System::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1729 | |||||||||||||||||||||||||||||||||||||||||||
| 1730 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1731 | |||||||||||||||||||||||||||||||||||||||||||
| 1732 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1733 | |||||||||||||||||||||||||||||||||||||||||||
| 1734 | sub as_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1735 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||||||||||||||||
| 1737 | return $self->do('name', 'auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1738 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1739 | |||||||||||||||||||||||||||||||||||||||||||
| 1740 | sub as_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1741 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1742 | |||||||||||||||||||||||||||||||||||||||||||
| 1743 | return $self->do('name', 'role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1744 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1745 | |||||||||||||||||||||||||||||||||||||||||||
| 1746 | sub is_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1747 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1748 | |||||||||||||||||||||||||||||||||||||||||||
| 1749 | return $self->name eq 'auth_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1750 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1751 | |||||||||||||||||||||||||||||||||||||||||||
| 1752 | sub is_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1753 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1754 | |||||||||||||||||||||||||||||||||||||||||||
| 1755 | return $self->name eq 'role_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1756 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1757 | |||||||||||||||||||||||||||||||||||||||||||
| 1758 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1759 | |||||||||||||||||||||||||||||||||||||||||||
| 1760 | my $of = System::Error->as('auth_error')->of('role'); | ||||||||||||||||||||||||||||||||||||||||||
| 1761 | |||||||||||||||||||||||||||||||||||||||||||
| 1762 | # 0 | ||||||||||||||||||||||||||||||||||||||||||
| 1763 | |||||||||||||||||||||||||||||||||||||||||||
| 1764 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1765 | |||||||||||||||||||||||||||||||||||||||||||
| 1766 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1767 | |||||||||||||||||||||||||||||||||||||||||||
| 1768 | =item of example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1769 | |||||||||||||||||||||||||||||||||||||||||||
| 1770 | package System::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1771 | |||||||||||||||||||||||||||||||||||||||||||
| 1772 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1773 | |||||||||||||||||||||||||||||||||||||||||||
| 1774 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1775 | |||||||||||||||||||||||||||||||||||||||||||
| 1776 | sub as_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1777 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1778 | |||||||||||||||||||||||||||||||||||||||||||
| 1779 | return $self->do('name', 'auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1780 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1781 | |||||||||||||||||||||||||||||||||||||||||||
| 1782 | sub as_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1783 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1784 | |||||||||||||||||||||||||||||||||||||||||||
| 1785 | return $self->do('name', 'role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1786 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1787 | |||||||||||||||||||||||||||||||||||||||||||
| 1788 | sub is_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1789 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1790 | |||||||||||||||||||||||||||||||||||||||||||
| 1791 | return $self->name eq 'auth_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1792 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1793 | |||||||||||||||||||||||||||||||||||||||||||
| 1794 | sub is_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1795 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1796 | |||||||||||||||||||||||||||||||||||||||||||
| 1797 | return $self->name eq 'role_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1798 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1799 | |||||||||||||||||||||||||||||||||||||||||||
| 1800 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1801 | |||||||||||||||||||||||||||||||||||||||||||
| 1802 | my $of = System::Error->as('auth_error')->of('auth'); | ||||||||||||||||||||||||||||||||||||||||||
| 1803 | |||||||||||||||||||||||||||||||||||||||||||
| 1804 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1805 | |||||||||||||||||||||||||||||||||||||||||||
| 1806 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1807 | |||||||||||||||||||||||||||||||||||||||||||
| 1808 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||||||||||||||||
| 1810 | =item of example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 1811 | |||||||||||||||||||||||||||||||||||||||||||
| 1812 | package System::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1813 | |||||||||||||||||||||||||||||||||||||||||||
| 1814 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||||||||||||||||
| 1816 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1817 | |||||||||||||||||||||||||||||||||||||||||||
| 1818 | sub as_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1819 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1820 | |||||||||||||||||||||||||||||||||||||||||||
| 1821 | return $self->do('name', 'auth_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1822 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||||||||||||||||
| 1824 | sub as_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1825 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||
| 1827 | return $self->do('name', 'role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1828 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1829 | |||||||||||||||||||||||||||||||||||||||||||
| 1830 | sub is_auth_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1831 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1832 | |||||||||||||||||||||||||||||||||||||||||||
| 1833 | return $self->name eq 'auth_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1834 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1835 | |||||||||||||||||||||||||||||||||||||||||||
| 1836 | sub is_role_error { | ||||||||||||||||||||||||||||||||||||||||||
| 1837 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1838 | |||||||||||||||||||||||||||||||||||||||||||
| 1839 | return $self->name eq 'role_error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1840 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1841 | |||||||||||||||||||||||||||||||||||||||||||
| 1842 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||
| 1844 | my $of = System::Error->as('auth_error')->of('role_error'); | ||||||||||||||||||||||||||||||||||||||||||
| 1845 | |||||||||||||||||||||||||||||||||||||||||||
| 1846 | # 0 | ||||||||||||||||||||||||||||||||||||||||||
| 1847 | |||||||||||||||||||||||||||||||||||||||||||
| 1848 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1849 | |||||||||||||||||||||||||||||||||||||||||||
| 1850 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1851 | |||||||||||||||||||||||||||||||||||||||||||
| 1852 | =item of example 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1853 | |||||||||||||||||||||||||||||||||||||||||||
| 1854 | package Virtual::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1855 | |||||||||||||||||||||||||||||||||||||||||||
| 1856 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1857 | |||||||||||||||||||||||||||||||||||||||||||
| 1858 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1859 | |||||||||||||||||||||||||||||||||||||||||||
| 1860 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1861 | |||||||||||||||||||||||||||||||||||||||||||
| 1862 | my $of = Virtual::Error->new->as('on_save_error')->of('on.save'); | ||||||||||||||||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||||||||||||||||
| 1864 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1865 | |||||||||||||||||||||||||||||||||||||||||||
| 1866 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1867 | |||||||||||||||||||||||||||||||||||||||||||
| 1868 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1869 | |||||||||||||||||||||||||||||||||||||||||||
| 1870 | =item of example 5 | ||||||||||||||||||||||||||||||||||||||||||
| 1871 | |||||||||||||||||||||||||||||||||||||||||||
| 1872 | package Virtual::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 1873 | |||||||||||||||||||||||||||||||||||||||||||
| 1874 | use Venus::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 1875 | |||||||||||||||||||||||||||||||||||||||||||
| 1876 | base 'Venus::Error'; | ||||||||||||||||||||||||||||||||||||||||||
| 1877 | |||||||||||||||||||||||||||||||||||||||||||
| 1878 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1879 | |||||||||||||||||||||||||||||||||||||||||||
| 1880 | my $of = Virtual::Error->new->as('on.SAVE.error')->of('on.save'); | ||||||||||||||||||||||||||||||||||||||||||
| 1881 | |||||||||||||||||||||||||||||||||||||||||||
| 1882 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1883 | |||||||||||||||||||||||||||||||||||||||||||
| 1884 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1885 | |||||||||||||||||||||||||||||||||||||||||||
| 1886 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1887 | |||||||||||||||||||||||||||||||||||||||||||
| 1888 | =head2 on | ||||||||||||||||||||||||||||||||||||||||||
| 1889 | |||||||||||||||||||||||||||||||||||||||||||
| 1890 | on(string $name) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 1891 | |||||||||||||||||||||||||||||||||||||||||||
| 1892 | The on method sets a L</name> for the error in the form of | ||||||||||||||||||||||||||||||||||||||||||
| 1893 | C<"on.$subroutine.$name"> or C<"on.$name"> (if outside of a subroutine) and | ||||||||||||||||||||||||||||||||||||||||||
| 1894 | returns the invocant. | ||||||||||||||||||||||||||||||||||||||||||
| 1895 | |||||||||||||||||||||||||||||||||||||||||||
| 1896 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 1897 | |||||||||||||||||||||||||||||||||||||||||||
| 1898 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1899 | |||||||||||||||||||||||||||||||||||||||||||
| 1900 | =item on example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1901 | |||||||||||||||||||||||||||||||||||||||||||
| 1902 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1903 | |||||||||||||||||||||||||||||||||||||||||||
| 1904 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1905 | |||||||||||||||||||||||||||||||||||||||||||
| 1906 | $error = $error->on('handler'); | ||||||||||||||||||||||||||||||||||||||||||
| 1907 | |||||||||||||||||||||||||||||||||||||||||||
| 1908 | # bless({...}, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 1909 | |||||||||||||||||||||||||||||||||||||||||||
| 1910 | # $error->name; | ||||||||||||||||||||||||||||||||||||||||||
| 1911 | |||||||||||||||||||||||||||||||||||||||||||
| 1912 | # "on.handler" | ||||||||||||||||||||||||||||||||||||||||||
| 1913 | |||||||||||||||||||||||||||||||||||||||||||
| 1914 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1915 | |||||||||||||||||||||||||||||||||||||||||||
| 1916 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1917 | |||||||||||||||||||||||||||||||||||||||||||
| 1918 | =head2 output | ||||||||||||||||||||||||||||||||||||||||||
| 1919 | |||||||||||||||||||||||||||||||||||||||||||
| 1920 | output(any @args) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 1921 | |||||||||||||||||||||||||||||||||||||||||||
| 1922 | The output method captures the arguments provided as associates them with a | ||||||||||||||||||||||||||||||||||||||||||
| 1923 | L<"callframe"|perlfunc/caller> based on the level specified by L</offset>, in | ||||||||||||||||||||||||||||||||||||||||||
| 1924 | the object stash, and returns the invocant. | ||||||||||||||||||||||||||||||||||||||||||
| 1925 | |||||||||||||||||||||||||||||||||||||||||||
| 1926 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 1927 | |||||||||||||||||||||||||||||||||||||||||||
| 1928 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1929 | |||||||||||||||||||||||||||||||||||||||||||
| 1930 | =item output example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1931 | |||||||||||||||||||||||||||||||||||||||||||
| 1932 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1933 | |||||||||||||||||||||||||||||||||||||||||||
| 1934 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1935 | |||||||||||||||||||||||||||||||||||||||||||
| 1936 | $error = $error->output(1..4); | ||||||||||||||||||||||||||||||||||||||||||
| 1937 | |||||||||||||||||||||||||||||||||||||||||||
| 1938 | # bless({...}, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 1939 | |||||||||||||||||||||||||||||||||||||||||||
| 1940 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1941 | |||||||||||||||||||||||||||||||||||||||||||
| 1942 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1943 | |||||||||||||||||||||||||||||||||||||||||||
| 1944 | =head2 render | ||||||||||||||||||||||||||||||||||||||||||
| 1945 | |||||||||||||||||||||||||||||||||||||||||||
| 1946 | render() (string) | ||||||||||||||||||||||||||||||||||||||||||
| 1947 | |||||||||||||||||||||||||||||||||||||||||||
| 1948 | The render method replaces tokens in the message with values from the stash and | ||||||||||||||||||||||||||||||||||||||||||
| 1949 | returns the formatted string. The token style and formatting operation is | ||||||||||||||||||||||||||||||||||||||||||
| 1950 | equivalent to the L<Venus::String/render> operation. | ||||||||||||||||||||||||||||||||||||||||||
| 1951 | |||||||||||||||||||||||||||||||||||||||||||
| 1952 | I<Since C<3.30>> | ||||||||||||||||||||||||||||||||||||||||||
| 1953 | |||||||||||||||||||||||||||||||||||||||||||
| 1954 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1955 | |||||||||||||||||||||||||||||||||||||||||||
| 1956 | =item render example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1957 | |||||||||||||||||||||||||||||||||||||||||||
| 1958 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1959 | |||||||||||||||||||||||||||||||||||||||||||
| 1960 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1961 | |||||||||||||||||||||||||||||||||||||||||||
| 1962 | $error->message('Signal received: {{signal}}'); | ||||||||||||||||||||||||||||||||||||||||||
| 1963 | |||||||||||||||||||||||||||||||||||||||||||
| 1964 | $error->stash(signal => 'SIGKILL'); | ||||||||||||||||||||||||||||||||||||||||||
| 1965 | |||||||||||||||||||||||||||||||||||||||||||
| 1966 | my $render = $error->render; | ||||||||||||||||||||||||||||||||||||||||||
| 1967 | |||||||||||||||||||||||||||||||||||||||||||
| 1968 | # "Signal received: SIGKILL" | ||||||||||||||||||||||||||||||||||||||||||
| 1969 | |||||||||||||||||||||||||||||||||||||||||||
| 1970 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1971 | |||||||||||||||||||||||||||||||||||||||||||
| 1972 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1973 | |||||||||||||||||||||||||||||||||||||||||||
| 1974 | =head2 reset | ||||||||||||||||||||||||||||||||||||||||||
| 1975 | |||||||||||||||||||||||||||||||||||||||||||
| 1976 | reset() (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 1977 | |||||||||||||||||||||||||||||||||||||||||||
| 1978 | The reset method resets the L</offset> and L</verbose> attributes if they're | ||||||||||||||||||||||||||||||||||||||||||
| 1979 | not already set, resets the L</context> based on the L<caller>, and rebuilds | ||||||||||||||||||||||||||||||||||||||||||
| 1980 | the stacktrace, then returns the invocant. | ||||||||||||||||||||||||||||||||||||||||||
| 1981 | |||||||||||||||||||||||||||||||||||||||||||
| 1982 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 1983 | |||||||||||||||||||||||||||||||||||||||||||
| 1984 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1985 | |||||||||||||||||||||||||||||||||||||||||||
| 1986 | =item reset example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1987 | |||||||||||||||||||||||||||||||||||||||||||
| 1988 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1989 | |||||||||||||||||||||||||||||||||||||||||||
| 1990 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 1991 | |||||||||||||||||||||||||||||||||||||||||||
| 1992 | my $reset = $error->reset; | ||||||||||||||||||||||||||||||||||||||||||
| 1993 | |||||||||||||||||||||||||||||||||||||||||||
| 1994 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 1995 | |||||||||||||||||||||||||||||||||||||||||||
| 1996 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1997 | |||||||||||||||||||||||||||||||||||||||||||
| 1998 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1999 | |||||||||||||||||||||||||||||||||||||||||||
| 2000 | =item reset example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2001 | |||||||||||||||||||||||||||||||||||||||||||
| 2002 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2003 | |||||||||||||||||||||||||||||||||||||||||||
| 2004 | use Venus::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 2005 | |||||||||||||||||||||||||||||||||||||||||||
| 2006 | my $error = Venus::Error->new(offset => 0, verbose => 0); | ||||||||||||||||||||||||||||||||||||||||||
| 2007 | |||||||||||||||||||||||||||||||||||||||||||
| 2008 | my $reset = $error->reset; | ||||||||||||||||||||||||||||||||||||||||||
| 2009 | |||||||||||||||||||||||||||||||||||||||||||
| 2010 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2011 | |||||||||||||||||||||||||||||||||||||||||||
| 2012 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2013 | |||||||||||||||||||||||||||||||||||||||||||
| 2014 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2015 | |||||||||||||||||||||||||||||||||||||||||||
| 2016 | =head2 set | ||||||||||||||||||||||||||||||||||||||||||
| 2017 | |||||||||||||||||||||||||||||||||||||||||||
| 2018 | set(any @args) (any) | ||||||||||||||||||||||||||||||||||||||||||
| 2019 | |||||||||||||||||||||||||||||||||||||||||||
| 2020 | The set method sets one or more attributes and/or methods on the invocant. This | ||||||||||||||||||||||||||||||||||||||||||
| 2021 | method accepts key/value pairs or a hashref of key/value pairs and returns the | ||||||||||||||||||||||||||||||||||||||||||
| 2022 | invocant. | ||||||||||||||||||||||||||||||||||||||||||
| 2023 | |||||||||||||||||||||||||||||||||||||||||||
| 2024 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2025 | |||||||||||||||||||||||||||||||||||||||||||
| 2026 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2027 | |||||||||||||||||||||||||||||||||||||||||||
| 2028 | =item set example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2029 | |||||||||||||||||||||||||||||||||||||||||||
| 2030 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2031 | |||||||||||||||||||||||||||||||||||||||||||
| 2032 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2033 | |||||||||||||||||||||||||||||||||||||||||||
| 2034 | my $set = $error->set(message => 'Oops!'); | ||||||||||||||||||||||||||||||||||||||||||
| 2035 | |||||||||||||||||||||||||||||||||||||||||||
| 2036 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2037 | |||||||||||||||||||||||||||||||||||||||||||
| 2038 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2039 | |||||||||||||||||||||||||||||||||||||||||||
| 2040 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2041 | |||||||||||||||||||||||||||||||||||||||||||
| 2042 | =item set example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2043 | |||||||||||||||||||||||||||||||||||||||||||
| 2044 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2045 | |||||||||||||||||||||||||||||||||||||||||||
| 2046 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2047 | |||||||||||||||||||||||||||||||||||||||||||
| 2048 | my $set = $error->set(message => 'Oops!', verbose => false); | ||||||||||||||||||||||||||||||||||||||||||
| 2049 | |||||||||||||||||||||||||||||||||||||||||||
| 2050 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2051 | |||||||||||||||||||||||||||||||||||||||||||
| 2052 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2053 | |||||||||||||||||||||||||||||||||||||||||||
| 2054 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2055 | |||||||||||||||||||||||||||||||||||||||||||
| 2056 | =item set example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 2057 | |||||||||||||||||||||||||||||||||||||||||||
| 2058 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2059 | |||||||||||||||||||||||||||||||||||||||||||
| 2060 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2061 | |||||||||||||||||||||||||||||||||||||||||||
| 2062 | my $set = $error->set({message => 'Oops!', verbose => false}); | ||||||||||||||||||||||||||||||||||||||||||
| 2063 | |||||||||||||||||||||||||||||||||||||||||||
| 2064 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2065 | |||||||||||||||||||||||||||||||||||||||||||
| 2066 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2067 | |||||||||||||||||||||||||||||||||||||||||||
| 2068 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2069 | |||||||||||||||||||||||||||||||||||||||||||
| 2070 | =head2 stash | ||||||||||||||||||||||||||||||||||||||||||
| 2071 | |||||||||||||||||||||||||||||||||||||||||||
| 2072 | stash(string $key, any $value) (any) | ||||||||||||||||||||||||||||||||||||||||||
| 2073 | |||||||||||||||||||||||||||||||||||||||||||
| 2074 | The stash method gets and sets ad-hoc data related to the invocant. | ||||||||||||||||||||||||||||||||||||||||||
| 2075 | |||||||||||||||||||||||||||||||||||||||||||
| 2076 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2077 | |||||||||||||||||||||||||||||||||||||||||||
| 2078 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2079 | |||||||||||||||||||||||||||||||||||||||||||
| 2080 | =item stash example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2081 | |||||||||||||||||||||||||||||||||||||||||||
| 2082 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2083 | |||||||||||||||||||||||||||||||||||||||||||
| 2084 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2085 | |||||||||||||||||||||||||||||||||||||||||||
| 2086 | my $stash = $error->stash; | ||||||||||||||||||||||||||||||||||||||||||
| 2087 | |||||||||||||||||||||||||||||||||||||||||||
| 2088 | # {} | ||||||||||||||||||||||||||||||||||||||||||
| 2089 | |||||||||||||||||||||||||||||||||||||||||||
| 2090 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2091 | |||||||||||||||||||||||||||||||||||||||||||
| 2092 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2093 | |||||||||||||||||||||||||||||||||||||||||||
| 2094 | =item stash example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2095 | |||||||||||||||||||||||||||||||||||||||||||
| 2096 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2097 | |||||||||||||||||||||||||||||||||||||||||||
| 2098 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2099 | |||||||||||||||||||||||||||||||||||||||||||
| 2100 | my $stash = $error->stash('package'); | ||||||||||||||||||||||||||||||||||||||||||
| 2101 | |||||||||||||||||||||||||||||||||||||||||||
| 2102 | # undef | ||||||||||||||||||||||||||||||||||||||||||
| 2103 | |||||||||||||||||||||||||||||||||||||||||||
| 2104 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2105 | |||||||||||||||||||||||||||||||||||||||||||
| 2106 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2107 | |||||||||||||||||||||||||||||||||||||||||||
| 2108 | =item stash example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 2109 | |||||||||||||||||||||||||||||||||||||||||||
| 2110 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2111 | |||||||||||||||||||||||||||||||||||||||||||
| 2112 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2113 | |||||||||||||||||||||||||||||||||||||||||||
| 2114 | my $stash = $error->stash('package', 'Example'); | ||||||||||||||||||||||||||||||||||||||||||
| 2115 | |||||||||||||||||||||||||||||||||||||||||||
| 2116 | # "Example" | ||||||||||||||||||||||||||||||||||||||||||
| 2117 | |||||||||||||||||||||||||||||||||||||||||||
| 2118 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2119 | |||||||||||||||||||||||||||||||||||||||||||
| 2120 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2121 | |||||||||||||||||||||||||||||||||||||||||||
| 2122 | =item stash example 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2123 | |||||||||||||||||||||||||||||||||||||||||||
| 2124 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2125 | |||||||||||||||||||||||||||||||||||||||||||
| 2126 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2127 | |||||||||||||||||||||||||||||||||||||||||||
| 2128 | $error->stash('package', 'Example'); | ||||||||||||||||||||||||||||||||||||||||||
| 2129 | |||||||||||||||||||||||||||||||||||||||||||
| 2130 | my $stash = $error->stash('package'); | ||||||||||||||||||||||||||||||||||||||||||
| 2131 | |||||||||||||||||||||||||||||||||||||||||||
| 2132 | # "Example" | ||||||||||||||||||||||||||||||||||||||||||
| 2133 | |||||||||||||||||||||||||||||||||||||||||||
| 2134 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2135 | |||||||||||||||||||||||||||||||||||||||||||
| 2136 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2137 | |||||||||||||||||||||||||||||||||||||||||||
| 2138 | =item stash example 5 | ||||||||||||||||||||||||||||||||||||||||||
| 2139 | |||||||||||||||||||||||||||||||||||||||||||
| 2140 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2141 | |||||||||||||||||||||||||||||||||||||||||||
| 2142 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2143 | |||||||||||||||||||||||||||||||||||||||||||
| 2144 | my $stash = $error->stash('package', 'Example', routine => 'execute'); | ||||||||||||||||||||||||||||||||||||||||||
| 2145 | |||||||||||||||||||||||||||||||||||||||||||
| 2146 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 2147 | # package => "Example", | ||||||||||||||||||||||||||||||||||||||||||
| 2148 | # routine => "execute", | ||||||||||||||||||||||||||||||||||||||||||
| 2149 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 2150 | |||||||||||||||||||||||||||||||||||||||||||
| 2151 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2152 | |||||||||||||||||||||||||||||||||||||||||||
| 2153 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2154 | |||||||||||||||||||||||||||||||||||||||||||
| 2155 | =item stash example 6 | ||||||||||||||||||||||||||||||||||||||||||
| 2156 | |||||||||||||||||||||||||||||||||||||||||||
| 2157 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2158 | |||||||||||||||||||||||||||||||||||||||||||
| 2159 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2160 | |||||||||||||||||||||||||||||||||||||||||||
| 2161 | my $stash = $error->stash({'package', 'Example', routine => 'execute'}); | ||||||||||||||||||||||||||||||||||||||||||
| 2162 | |||||||||||||||||||||||||||||||||||||||||||
| 2163 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 2164 | # package => "Example", | ||||||||||||||||||||||||||||||||||||||||||
| 2165 | # routine => "execute", | ||||||||||||||||||||||||||||||||||||||||||
| 2166 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 2167 | |||||||||||||||||||||||||||||||||||||||||||
| 2168 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2169 | |||||||||||||||||||||||||||||||||||||||||||
| 2170 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2171 | |||||||||||||||||||||||||||||||||||||||||||
| 2172 | =head2 sysinfo | ||||||||||||||||||||||||||||||||||||||||||
| 2173 | |||||||||||||||||||||||||||||||||||||||||||
| 2174 | sysinfo() (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2175 | |||||||||||||||||||||||||||||||||||||||||||
| 2176 | The sysinfo method calls all the C<system_*> methods and L<"stashes"|/stash> | ||||||||||||||||||||||||||||||||||||||||||
| 2177 | the system information. | ||||||||||||||||||||||||||||||||||||||||||
| 2178 | |||||||||||||||||||||||||||||||||||||||||||
| 2179 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2180 | |||||||||||||||||||||||||||||||||||||||||||
| 2181 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2182 | |||||||||||||||||||||||||||||||||||||||||||
| 2183 | =item sysinfo example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2184 | |||||||||||||||||||||||||||||||||||||||||||
| 2185 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2186 | |||||||||||||||||||||||||||||||||||||||||||
| 2187 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2188 | |||||||||||||||||||||||||||||||||||||||||||
| 2189 | my $sysinfo = $error->sysinfo; | ||||||||||||||||||||||||||||||||||||||||||
| 2190 | |||||||||||||||||||||||||||||||||||||||||||
| 2191 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2192 | |||||||||||||||||||||||||||||||||||||||||||
| 2193 | # $error->stash('system_name'); | ||||||||||||||||||||||||||||||||||||||||||
| 2194 | |||||||||||||||||||||||||||||||||||||||||||
| 2195 | # $^O | ||||||||||||||||||||||||||||||||||||||||||
| 2196 | |||||||||||||||||||||||||||||||||||||||||||
| 2197 | # $error->stash('system_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2198 | |||||||||||||||||||||||||||||||||||||||||||
| 2199 | # /path/to/cwd | ||||||||||||||||||||||||||||||||||||||||||
| 2200 | |||||||||||||||||||||||||||||||||||||||||||
| 2201 | # $error->stash('system_perl_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2202 | |||||||||||||||||||||||||||||||||||||||||||
| 2203 | # $^X | ||||||||||||||||||||||||||||||||||||||||||
| 2204 | |||||||||||||||||||||||||||||||||||||||||||
| 2205 | # $error->stash('system_perl_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2206 | |||||||||||||||||||||||||||||||||||||||||||
| 2207 | # $^X | ||||||||||||||||||||||||||||||||||||||||||
| 2208 | |||||||||||||||||||||||||||||||||||||||||||
| 2209 | # $error->stash('system_perl_version'); | ||||||||||||||||||||||||||||||||||||||||||
| 2210 | |||||||||||||||||||||||||||||||||||||||||||
| 2211 | # $^V | ||||||||||||||||||||||||||||||||||||||||||
| 2212 | |||||||||||||||||||||||||||||||||||||||||||
| 2213 | # $error->stash('system_process_id'); | ||||||||||||||||||||||||||||||||||||||||||
| 2214 | |||||||||||||||||||||||||||||||||||||||||||
| 2215 | # $$ | ||||||||||||||||||||||||||||||||||||||||||
| 2216 | |||||||||||||||||||||||||||||||||||||||||||
| 2217 | # $error->stash('system_script_args'); | ||||||||||||||||||||||||||||||||||||||||||
| 2218 | |||||||||||||||||||||||||||||||||||||||||||
| 2219 | # [@ARGV] | ||||||||||||||||||||||||||||||||||||||||||
| 2220 | |||||||||||||||||||||||||||||||||||||||||||
| 2221 | # $error->stash('system_script_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2222 | |||||||||||||||||||||||||||||||||||||||||||
| 2223 | # $0 | ||||||||||||||||||||||||||||||||||||||||||
| 2224 | |||||||||||||||||||||||||||||||||||||||||||
| 2225 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2226 | |||||||||||||||||||||||||||||||||||||||||||
| 2227 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2228 | |||||||||||||||||||||||||||||||||||||||||||
| 2229 | =head2 system_name | ||||||||||||||||||||||||||||||||||||||||||
| 2230 | |||||||||||||||||||||||||||||||||||||||||||
| 2231 | system_name(string $value) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2232 | |||||||||||||||||||||||||||||||||||||||||||
| 2233 | The system_name method L<"stashes"|/stash> a value representing the | ||||||||||||||||||||||||||||||||||||||||||
| 2234 | I<"system name"> and returns the invocant. If no value is provided this method | ||||||||||||||||||||||||||||||||||||||||||
| 2235 | will use C<$^O> as the default. | ||||||||||||||||||||||||||||||||||||||||||
| 2236 | |||||||||||||||||||||||||||||||||||||||||||
| 2237 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2238 | |||||||||||||||||||||||||||||||||||||||||||
| 2239 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2240 | |||||||||||||||||||||||||||||||||||||||||||
| 2241 | =item system_name example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2242 | |||||||||||||||||||||||||||||||||||||||||||
| 2243 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2244 | |||||||||||||||||||||||||||||||||||||||||||
| 2245 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2246 | |||||||||||||||||||||||||||||||||||||||||||
| 2247 | my $system_name = $error->system_name; | ||||||||||||||||||||||||||||||||||||||||||
| 2248 | |||||||||||||||||||||||||||||||||||||||||||
| 2249 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2250 | |||||||||||||||||||||||||||||||||||||||||||
| 2251 | # $error->stash('system_name'); | ||||||||||||||||||||||||||||||||||||||||||
| 2252 | |||||||||||||||||||||||||||||||||||||||||||
| 2253 | # $^O | ||||||||||||||||||||||||||||||||||||||||||
| 2254 | |||||||||||||||||||||||||||||||||||||||||||
| 2255 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2256 | |||||||||||||||||||||||||||||||||||||||||||
| 2257 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2258 | |||||||||||||||||||||||||||||||||||||||||||
| 2259 | =item system_name example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2260 | |||||||||||||||||||||||||||||||||||||||||||
| 2261 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2262 | |||||||||||||||||||||||||||||||||||||||||||
| 2263 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2264 | |||||||||||||||||||||||||||||||||||||||||||
| 2265 | my $system_name = $error->system_name($^O); | ||||||||||||||||||||||||||||||||||||||||||
| 2266 | |||||||||||||||||||||||||||||||||||||||||||
| 2267 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2268 | |||||||||||||||||||||||||||||||||||||||||||
| 2269 | # $error->stash('system_name'); | ||||||||||||||||||||||||||||||||||||||||||
| 2270 | |||||||||||||||||||||||||||||||||||||||||||
| 2271 | # $^O | ||||||||||||||||||||||||||||||||||||||||||
| 2272 | |||||||||||||||||||||||||||||||||||||||||||
| 2273 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2274 | |||||||||||||||||||||||||||||||||||||||||||
| 2275 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2276 | |||||||||||||||||||||||||||||||||||||||||||
| 2277 | =head2 system_path | ||||||||||||||||||||||||||||||||||||||||||
| 2278 | |||||||||||||||||||||||||||||||||||||||||||
| 2279 | system_path(string $value) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2280 | |||||||||||||||||||||||||||||||||||||||||||
| 2281 | The system_path method L<"stashes"|/stash> a value representing the | ||||||||||||||||||||||||||||||||||||||||||
| 2282 | I<"system_path"> and returns the invocant. If no value is provided this method | ||||||||||||||||||||||||||||||||||||||||||
| 2283 | will use C<Cwd/getcwd> as the default. | ||||||||||||||||||||||||||||||||||||||||||
| 2284 | |||||||||||||||||||||||||||||||||||||||||||
| 2285 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2286 | |||||||||||||||||||||||||||||||||||||||||||
| 2287 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2288 | |||||||||||||||||||||||||||||||||||||||||||
| 2289 | =item system_path example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2290 | |||||||||||||||||||||||||||||||||||||||||||
| 2291 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2292 | |||||||||||||||||||||||||||||||||||||||||||
| 2293 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2294 | |||||||||||||||||||||||||||||||||||||||||||
| 2295 | my $system_path = $error->system_path; | ||||||||||||||||||||||||||||||||||||||||||
| 2296 | |||||||||||||||||||||||||||||||||||||||||||
| 2297 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2298 | |||||||||||||||||||||||||||||||||||||||||||
| 2299 | # $error->stash('system_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2300 | |||||||||||||||||||||||||||||||||||||||||||
| 2301 | # /path/to/cwd | ||||||||||||||||||||||||||||||||||||||||||
| 2302 | |||||||||||||||||||||||||||||||||||||||||||
| 2303 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2304 | |||||||||||||||||||||||||||||||||||||||||||
| 2305 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2306 | |||||||||||||||||||||||||||||||||||||||||||
| 2307 | =item system_path example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2308 | |||||||||||||||||||||||||||||||||||||||||||
| 2309 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2310 | |||||||||||||||||||||||||||||||||||||||||||
| 2311 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2312 | |||||||||||||||||||||||||||||||||||||||||||
| 2313 | use Cwd (); | ||||||||||||||||||||||||||||||||||||||||||
| 2314 | |||||||||||||||||||||||||||||||||||||||||||
| 2315 | my $system_path = $error->system_path(Cwd->getcwd); | ||||||||||||||||||||||||||||||||||||||||||
| 2316 | |||||||||||||||||||||||||||||||||||||||||||
| 2317 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2318 | |||||||||||||||||||||||||||||||||||||||||||
| 2319 | # $error->stash('system_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2320 | |||||||||||||||||||||||||||||||||||||||||||
| 2321 | # /path/to/cwd | ||||||||||||||||||||||||||||||||||||||||||
| 2322 | |||||||||||||||||||||||||||||||||||||||||||
| 2323 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2324 | |||||||||||||||||||||||||||||||||||||||||||
| 2325 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2326 | |||||||||||||||||||||||||||||||||||||||||||
| 2327 | =head2 system_perl_path | ||||||||||||||||||||||||||||||||||||||||||
| 2328 | |||||||||||||||||||||||||||||||||||||||||||
| 2329 | system_perl_path(string $value) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2330 | |||||||||||||||||||||||||||||||||||||||||||
| 2331 | The system_perl_path method L<"stashes"|/stash> a value representing the | ||||||||||||||||||||||||||||||||||||||||||
| 2332 | I<"system_perl_path"> and returns the invocant. If no value is provided this | ||||||||||||||||||||||||||||||||||||||||||
| 2333 | method will use C<$^X> as the default. | ||||||||||||||||||||||||||||||||||||||||||
| 2334 | |||||||||||||||||||||||||||||||||||||||||||
| 2335 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2336 | |||||||||||||||||||||||||||||||||||||||||||
| 2337 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2338 | |||||||||||||||||||||||||||||||||||||||||||
| 2339 | =item system_perl_path example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2340 | |||||||||||||||||||||||||||||||||||||||||||
| 2341 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2342 | |||||||||||||||||||||||||||||||||||||||||||
| 2343 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2344 | |||||||||||||||||||||||||||||||||||||||||||
| 2345 | my $system_perl_path = $error->system_perl_path; | ||||||||||||||||||||||||||||||||||||||||||
| 2346 | |||||||||||||||||||||||||||||||||||||||||||
| 2347 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2348 | |||||||||||||||||||||||||||||||||||||||||||
| 2349 | # $error->stash('system_perl_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2350 | |||||||||||||||||||||||||||||||||||||||||||
| 2351 | # $^X | ||||||||||||||||||||||||||||||||||||||||||
| 2352 | |||||||||||||||||||||||||||||||||||||||||||
| 2353 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2354 | |||||||||||||||||||||||||||||||||||||||||||
| 2355 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2356 | |||||||||||||||||||||||||||||||||||||||||||
| 2357 | =item system_perl_path example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2358 | |||||||||||||||||||||||||||||||||||||||||||
| 2359 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2360 | |||||||||||||||||||||||||||||||||||||||||||
| 2361 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2362 | |||||||||||||||||||||||||||||||||||||||||||
| 2363 | my $system_perl_path = $error->system_perl_path($^X); | ||||||||||||||||||||||||||||||||||||||||||
| 2364 | |||||||||||||||||||||||||||||||||||||||||||
| 2365 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2366 | |||||||||||||||||||||||||||||||||||||||||||
| 2367 | # $error->stash('system_perl_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2368 | |||||||||||||||||||||||||||||||||||||||||||
| 2369 | # $^X | ||||||||||||||||||||||||||||||||||||||||||
| 2370 | |||||||||||||||||||||||||||||||||||||||||||
| 2371 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2372 | |||||||||||||||||||||||||||||||||||||||||||
| 2373 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2374 | |||||||||||||||||||||||||||||||||||||||||||
| 2375 | =head2 system_perl_version | ||||||||||||||||||||||||||||||||||||||||||
| 2376 | |||||||||||||||||||||||||||||||||||||||||||
| 2377 | system_perl_version(string $value) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2378 | |||||||||||||||||||||||||||||||||||||||||||
| 2379 | The system_perl_version method L<"stashes"|/stash> a value representing the | ||||||||||||||||||||||||||||||||||||||||||
| 2380 | I<"system_perl_version"> and returns the invocant. If no value is provided this | ||||||||||||||||||||||||||||||||||||||||||
| 2381 | method will use C<$^V> as the default. | ||||||||||||||||||||||||||||||||||||||||||
| 2382 | |||||||||||||||||||||||||||||||||||||||||||
| 2383 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2384 | |||||||||||||||||||||||||||||||||||||||||||
| 2385 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2386 | |||||||||||||||||||||||||||||||||||||||||||
| 2387 | =item system_perl_version example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2388 | |||||||||||||||||||||||||||||||||||||||||||
| 2389 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2390 | |||||||||||||||||||||||||||||||||||||||||||
| 2391 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2392 | |||||||||||||||||||||||||||||||||||||||||||
| 2393 | my $system_perl_version = $error->system_perl_version; | ||||||||||||||||||||||||||||||||||||||||||
| 2394 | |||||||||||||||||||||||||||||||||||||||||||
| 2395 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2396 | |||||||||||||||||||||||||||||||||||||||||||
| 2397 | # $error->stash('system_perl_version'); | ||||||||||||||||||||||||||||||||||||||||||
| 2398 | |||||||||||||||||||||||||||||||||||||||||||
| 2399 | # $^V | ||||||||||||||||||||||||||||||||||||||||||
| 2400 | |||||||||||||||||||||||||||||||||||||||||||
| 2401 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2402 | |||||||||||||||||||||||||||||||||||||||||||
| 2403 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2404 | |||||||||||||||||||||||||||||||||||||||||||
| 2405 | =item system_perl_version example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2406 | |||||||||||||||||||||||||||||||||||||||||||
| 2407 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2408 | |||||||||||||||||||||||||||||||||||||||||||
| 2409 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2410 | |||||||||||||||||||||||||||||||||||||||||||
| 2411 | my $system_perl_version = $error->system_perl_version($^V); | ||||||||||||||||||||||||||||||||||||||||||
| 2412 | |||||||||||||||||||||||||||||||||||||||||||
| 2413 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2414 | |||||||||||||||||||||||||||||||||||||||||||
| 2415 | # $error->stash('system_perl_version'); | ||||||||||||||||||||||||||||||||||||||||||
| 2416 | |||||||||||||||||||||||||||||||||||||||||||
| 2417 | # $^V | ||||||||||||||||||||||||||||||||||||||||||
| 2418 | |||||||||||||||||||||||||||||||||||||||||||
| 2419 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2420 | |||||||||||||||||||||||||||||||||||||||||||
| 2421 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2422 | |||||||||||||||||||||||||||||||||||||||||||
| 2423 | =head2 system_process_id | ||||||||||||||||||||||||||||||||||||||||||
| 2424 | |||||||||||||||||||||||||||||||||||||||||||
| 2425 | system_process_id(string $value) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2426 | |||||||||||||||||||||||||||||||||||||||||||
| 2427 | The system_process_id method L<"stashes"|/stash> a value representing the | ||||||||||||||||||||||||||||||||||||||||||
| 2428 | I<"system_process_id"> and returns the invocant. If no value is provided this | ||||||||||||||||||||||||||||||||||||||||||
| 2429 | method will use C<$$> as the default. | ||||||||||||||||||||||||||||||||||||||||||
| 2430 | |||||||||||||||||||||||||||||||||||||||||||
| 2431 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2432 | |||||||||||||||||||||||||||||||||||||||||||
| 2433 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2434 | |||||||||||||||||||||||||||||||||||||||||||
| 2435 | =item system_process_id example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2436 | |||||||||||||||||||||||||||||||||||||||||||
| 2437 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2438 | |||||||||||||||||||||||||||||||||||||||||||
| 2439 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2440 | |||||||||||||||||||||||||||||||||||||||||||
| 2441 | my $system_process_id = $error->system_process_id; | ||||||||||||||||||||||||||||||||||||||||||
| 2442 | |||||||||||||||||||||||||||||||||||||||||||
| 2443 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2444 | |||||||||||||||||||||||||||||||||||||||||||
| 2445 | # $error->stash('system_process_id'); | ||||||||||||||||||||||||||||||||||||||||||
| 2446 | |||||||||||||||||||||||||||||||||||||||||||
| 2447 | # $$ | ||||||||||||||||||||||||||||||||||||||||||
| 2448 | |||||||||||||||||||||||||||||||||||||||||||
| 2449 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2450 | |||||||||||||||||||||||||||||||||||||||||||
| 2451 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2452 | |||||||||||||||||||||||||||||||||||||||||||
| 2453 | =item system_process_id example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2454 | |||||||||||||||||||||||||||||||||||||||||||
| 2455 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2456 | |||||||||||||||||||||||||||||||||||||||||||
| 2457 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2458 | |||||||||||||||||||||||||||||||||||||||||||
| 2459 | my $system_process_id = $error->system_process_id($$); | ||||||||||||||||||||||||||||||||||||||||||
| 2460 | |||||||||||||||||||||||||||||||||||||||||||
| 2461 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2462 | |||||||||||||||||||||||||||||||||||||||||||
| 2463 | # $error->stash('system_process_id'); | ||||||||||||||||||||||||||||||||||||||||||
| 2464 | |||||||||||||||||||||||||||||||||||||||||||
| 2465 | # $$ | ||||||||||||||||||||||||||||||||||||||||||
| 2466 | |||||||||||||||||||||||||||||||||||||||||||
| 2467 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2468 | |||||||||||||||||||||||||||||||||||||||||||
| 2469 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2470 | |||||||||||||||||||||||||||||||||||||||||||
| 2471 | =head2 system_script_args | ||||||||||||||||||||||||||||||||||||||||||
| 2472 | |||||||||||||||||||||||||||||||||||||||||||
| 2473 | system_script_args(string $value) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2474 | |||||||||||||||||||||||||||||||||||||||||||
| 2475 | The system_script_args method L<"stashes"|/stash> a value representing the | ||||||||||||||||||||||||||||||||||||||||||
| 2476 | I<"system"> and returns the invocant. If no value is provided this method will | ||||||||||||||||||||||||||||||||||||||||||
| 2477 | use C<[@ARGV]> as the default. | ||||||||||||||||||||||||||||||||||||||||||
| 2478 | |||||||||||||||||||||||||||||||||||||||||||
| 2479 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2480 | |||||||||||||||||||||||||||||||||||||||||||
| 2481 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2482 | |||||||||||||||||||||||||||||||||||||||||||
| 2483 | =item system_script_args example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2484 | |||||||||||||||||||||||||||||||||||||||||||
| 2485 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2486 | |||||||||||||||||||||||||||||||||||||||||||
| 2487 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2488 | |||||||||||||||||||||||||||||||||||||||||||
| 2489 | my $system_script_args = $error->system_script_args; | ||||||||||||||||||||||||||||||||||||||||||
| 2490 | |||||||||||||||||||||||||||||||||||||||||||
| 2491 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2492 | |||||||||||||||||||||||||||||||||||||||||||
| 2493 | # $error->stash('system_script_args'); | ||||||||||||||||||||||||||||||||||||||||||
| 2494 | |||||||||||||||||||||||||||||||||||||||||||
| 2495 | # [@ARGV] | ||||||||||||||||||||||||||||||||||||||||||
| 2496 | |||||||||||||||||||||||||||||||||||||||||||
| 2497 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2498 | |||||||||||||||||||||||||||||||||||||||||||
| 2499 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2500 | |||||||||||||||||||||||||||||||||||||||||||
| 2501 | =item system_script_args example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2502 | |||||||||||||||||||||||||||||||||||||||||||
| 2503 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2504 | |||||||||||||||||||||||||||||||||||||||||||
| 2505 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2506 | |||||||||||||||||||||||||||||||||||||||||||
| 2507 | my $system_script_args = $error->system_script_args(@ARGV); | ||||||||||||||||||||||||||||||||||||||||||
| 2508 | |||||||||||||||||||||||||||||||||||||||||||
| 2509 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2510 | |||||||||||||||||||||||||||||||||||||||||||
| 2511 | # $error->stash('system_script_args'); | ||||||||||||||||||||||||||||||||||||||||||
| 2512 | |||||||||||||||||||||||||||||||||||||||||||
| 2513 | # [@ARGV] | ||||||||||||||||||||||||||||||||||||||||||
| 2514 | |||||||||||||||||||||||||||||||||||||||||||
| 2515 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2516 | |||||||||||||||||||||||||||||||||||||||||||
| 2517 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2518 | |||||||||||||||||||||||||||||||||||||||||||
| 2519 | =head2 system_script_path | ||||||||||||||||||||||||||||||||||||||||||
| 2520 | |||||||||||||||||||||||||||||||||||||||||||
| 2521 | system_script_path(string $value) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2522 | |||||||||||||||||||||||||||||||||||||||||||
| 2523 | The system_script_path method L<"stashes"|/stash> a value representing the | ||||||||||||||||||||||||||||||||||||||||||
| 2524 | I<"system_script_path"> and returns the invocant. If no value is provided this | ||||||||||||||||||||||||||||||||||||||||||
| 2525 | method will use C<$0> as the default. | ||||||||||||||||||||||||||||||||||||||||||
| 2526 | |||||||||||||||||||||||||||||||||||||||||||
| 2527 | I<Since C<4.15>> | ||||||||||||||||||||||||||||||||||||||||||
| 2528 | |||||||||||||||||||||||||||||||||||||||||||
| 2529 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2530 | |||||||||||||||||||||||||||||||||||||||||||
| 2531 | =item system_script_path example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2532 | |||||||||||||||||||||||||||||||||||||||||||
| 2533 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2534 | |||||||||||||||||||||||||||||||||||||||||||
| 2535 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2536 | |||||||||||||||||||||||||||||||||||||||||||
| 2537 | my $system_script_path = $error->system_script_path; | ||||||||||||||||||||||||||||||||||||||||||
| 2538 | |||||||||||||||||||||||||||||||||||||||||||
| 2539 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2540 | |||||||||||||||||||||||||||||||||||||||||||
| 2541 | # $error->stash('system_script_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2542 | |||||||||||||||||||||||||||||||||||||||||||
| 2543 | # $0 | ||||||||||||||||||||||||||||||||||||||||||
| 2544 | |||||||||||||||||||||||||||||||||||||||||||
| 2545 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2546 | |||||||||||||||||||||||||||||||||||||||||||
| 2547 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2548 | |||||||||||||||||||||||||||||||||||||||||||
| 2549 | =item system_script_path example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2550 | |||||||||||||||||||||||||||||||||||||||||||
| 2551 | # given: synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 2552 | |||||||||||||||||||||||||||||||||||||||||||
| 2553 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 2554 | |||||||||||||||||||||||||||||||||||||||||||
| 2555 | my $system_script_path = $error->system_script_path($0); | ||||||||||||||||||||||||||||||||||||||||||
| 2556 | |||||||||||||||||||||||||||||||||||||||||||
| 2557 | # bless(..., "Venus::Error") | ||||||||||||||||||||||||||||||||||||||||||
| 2558 | |||||||||||||||||||||||||||||||||||||||||||
| 2559 | # $error->stash('system_script_path'); | ||||||||||||||||||||||||||||||||||||||||||
| 2560 | |||||||||||||||||||||||||||||||||||||||||||
| 2561 | # $0 | ||||||||||||||||||||||||||||||||||||||||||
| 2562 | |||||||||||||||||||||||||||||||||||||||||||
| 2563 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2564 | |||||||||||||||||||||||||||||||||||||||||||
| 2565 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2566 | |||||||||||||||||||||||||||||||||||||||||||
| 2567 | =head2 throw | ||||||||||||||||||||||||||||||||||||||||||
| 2568 | |||||||||||||||||||||||||||||||||||||||||||
| 2569 | throw(any @data) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2570 | |||||||||||||||||||||||||||||||||||||||||||
| 2571 | The throw method throws an error if the invocant is an object, or creates an | ||||||||||||||||||||||||||||||||||||||||||
| 2572 | error object using the arguments provided and throws the created object. | ||||||||||||||||||||||||||||||||||||||||||
| 2573 | |||||||||||||||||||||||||||||||||||||||||||
| 2574 | I<Since C<0.01>> | ||||||||||||||||||||||||||||||||||||||||||
| 2575 | |||||||||||||||||||||||||||||||||||||||||||
| 2576 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2577 | |||||||||||||||||||||||||||||||||||||||||||
| 2578 | =item throw example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2579 | |||||||||||||||||||||||||||||||||||||||||||
| 2580 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 2581 | |||||||||||||||||||||||||||||||||||||||||||
| 2582 | my $throw = $error->throw; | ||||||||||||||||||||||||||||||||||||||||||
| 2583 | |||||||||||||||||||||||||||||||||||||||||||
| 2584 | # bless({ ... }, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 2585 | |||||||||||||||||||||||||||||||||||||||||||
| 2586 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2587 | |||||||||||||||||||||||||||||||||||||||||||
| 2588 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2589 | |||||||||||||||||||||||||||||||||||||||||||
| 2590 | =head2 trace | ||||||||||||||||||||||||||||||||||||||||||
| 2591 | |||||||||||||||||||||||||||||||||||||||||||
| 2592 | trace(number $offset, number $limit) (Venus::Error) | ||||||||||||||||||||||||||||||||||||||||||
| 2593 | |||||||||||||||||||||||||||||||||||||||||||
| 2594 | The trace method compiles a stack trace and returns the object. By default it | ||||||||||||||||||||||||||||||||||||||||||
| 2595 | skips the first frame. | ||||||||||||||||||||||||||||||||||||||||||
| 2596 | |||||||||||||||||||||||||||||||||||||||||||
| 2597 | I<Since C<0.01>> | ||||||||||||||||||||||||||||||||||||||||||
| 2598 | |||||||||||||||||||||||||||||||||||||||||||
| 2599 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2600 | |||||||||||||||||||||||||||||||||||||||||||
| 2601 | =item trace example 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2602 | |||||||||||||||||||||||||||||||||||||||||||
| 2603 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 2604 | |||||||||||||||||||||||||||||||||||||||||||
| 2605 | my $trace = $error->trace; | ||||||||||||||||||||||||||||||||||||||||||
| 2606 | |||||||||||||||||||||||||||||||||||||||||||
| 2607 | # bless({ ... }, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 2608 | |||||||||||||||||||||||||||||||||||||||||||
| 2609 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2610 | |||||||||||||||||||||||||||||||||||||||||||
| 2611 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2612 | |||||||||||||||||||||||||||||||||||||||||||
| 2613 | =item trace example 2 | ||||||||||||||||||||||||||||||||||||||||||
| 2614 | |||||||||||||||||||||||||||||||||||||||||||
| 2615 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 2616 | |||||||||||||||||||||||||||||||||||||||||||
| 2617 | my $trace = $error->trace(0, 1); | ||||||||||||||||||||||||||||||||||||||||||
| 2618 | |||||||||||||||||||||||||||||||||||||||||||
| 2619 | # bless({ ... }, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 2620 | |||||||||||||||||||||||||||||||||||||||||||
| 2621 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2622 | |||||||||||||||||||||||||||||||||||||||||||
| 2623 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2624 | |||||||||||||||||||||||||||||||||||||||||||
| 2625 | =item trace example 3 | ||||||||||||||||||||||||||||||||||||||||||
| 2626 | |||||||||||||||||||||||||||||||||||||||||||
| 2627 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 2628 | |||||||||||||||||||||||||||||||||||||||||||
| 2629 | my $trace = $error->trace(0, 2); | ||||||||||||||||||||||||||||||||||||||||||
| 2630 | |||||||||||||||||||||||||||||||||||||||||||
| 2631 | # bless({ ... }, 'Venus::Error') | ||||||||||||||||||||||||||||||||||||||||||
| 2632 | |||||||||||||||||||||||||||||||||||||||||||
| 2633 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2634 | |||||||||||||||||||||||||||||||||||||||||||
| 2635 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2636 | |||||||||||||||||||||||||||||||||||||||||||
| 2637 | =head1 OPERATORS | ||||||||||||||||||||||||||||||||||||||||||
| 2638 | |||||||||||||||||||||||||||||||||||||||||||
| 2639 | This package overloads the following operators: | ||||||||||||||||||||||||||||||||||||||||||
| 2640 | |||||||||||||||||||||||||||||||||||||||||||
| 2641 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2642 | |||||||||||||||||||||||||||||||||||||||||||
| 2643 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2644 | |||||||||||||||||||||||||||||||||||||||||||
| 2645 | =item operation: C<("")> | ||||||||||||||||||||||||||||||||||||||||||
| 2646 | |||||||||||||||||||||||||||||||||||||||||||
| 2647 | This package overloads the C<""> operator. | ||||||||||||||||||||||||||||||||||||||||||
| 2648 | |||||||||||||||||||||||||||||||||||||||||||
| 2649 | B<example 1> | ||||||||||||||||||||||||||||||||||||||||||
| 2650 | |||||||||||||||||||||||||||||||||||||||||||
| 2651 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 2652 | |||||||||||||||||||||||||||||||||||||||||||
| 2653 | my $result = "$error"; | ||||||||||||||||||||||||||||||||||||||||||
| 2654 | |||||||||||||||||||||||||||||||||||||||||||
| 2655 | # "Exception!" | ||||||||||||||||||||||||||||||||||||||||||
| 2656 | |||||||||||||||||||||||||||||||||||||||||||
| 2657 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2658 | |||||||||||||||||||||||||||||||||||||||||||
| 2659 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2660 | |||||||||||||||||||||||||||||||||||||||||||
| 2661 | =item operation: C<(eq)> | ||||||||||||||||||||||||||||||||||||||||||
| 2662 | |||||||||||||||||||||||||||||||||||||||||||
| 2663 | This package overloads the C<eq> operator. | ||||||||||||||||||||||||||||||||||||||||||
| 2664 | |||||||||||||||||||||||||||||||||||||||||||
| 2665 | B<example 1> | ||||||||||||||||||||||||||||||||||||||||||
| 2666 | |||||||||||||||||||||||||||||||||||||||||||
| 2667 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 2668 | |||||||||||||||||||||||||||||||||||||||||||
| 2669 | my $result = $error eq 'Exception!'; | ||||||||||||||||||||||||||||||||||||||||||
| 2670 | |||||||||||||||||||||||||||||||||||||||||||
| 2671 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2672 | |||||||||||||||||||||||||||||||||||||||||||
| 2673 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2674 | |||||||||||||||||||||||||||||||||||||||||||
| 2675 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2676 | |||||||||||||||||||||||||||||||||||||||||||
| 2677 | =item operation: C<(ne)> | ||||||||||||||||||||||||||||||||||||||||||
| 2678 | |||||||||||||||||||||||||||||||||||||||||||
| 2679 | This package overloads the C<ne> operator. | ||||||||||||||||||||||||||||||||||||||||||
| 2680 | |||||||||||||||||||||||||||||||||||||||||||
| 2681 | B<example 1> | ||||||||||||||||||||||||||||||||||||||||||
| 2682 | |||||||||||||||||||||||||||||||||||||||||||
| 2683 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 2684 | |||||||||||||||||||||||||||||||||||||||||||
| 2685 | my $result = $error ne 'exception!'; | ||||||||||||||||||||||||||||||||||||||||||
| 2686 | |||||||||||||||||||||||||||||||||||||||||||
| 2687 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2688 | |||||||||||||||||||||||||||||||||||||||||||
| 2689 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2690 | |||||||||||||||||||||||||||||||||||||||||||
| 2691 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2692 | |||||||||||||||||||||||||||||||||||||||||||
| 2693 | =item operation: C<(qr)> | ||||||||||||||||||||||||||||||||||||||||||
| 2694 | |||||||||||||||||||||||||||||||||||||||||||
| 2695 | This package overloads the C<qr> operator. | ||||||||||||||||||||||||||||||||||||||||||
| 2696 | |||||||||||||||||||||||||||||||||||||||||||
| 2697 | B<example 1> | ||||||||||||||||||||||||||||||||||||||||||
| 2698 | |||||||||||||||||||||||||||||||||||||||||||
| 2699 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 2700 | |||||||||||||||||||||||||||||||||||||||||||
| 2701 | my $test = 'Exception!' =~ qr/$error/; | ||||||||||||||||||||||||||||||||||||||||||
| 2702 | |||||||||||||||||||||||||||||||||||||||||||
| 2703 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2704 | |||||||||||||||||||||||||||||||||||||||||||
| 2705 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2706 | |||||||||||||||||||||||||||||||||||||||||||
| 2707 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2708 | |||||||||||||||||||||||||||||||||||||||||||
| 2709 | =item operation: C<(~~)> | ||||||||||||||||||||||||||||||||||||||||||
| 2710 | |||||||||||||||||||||||||||||||||||||||||||
| 2711 | This package overloads the C<~~> operator. | ||||||||||||||||||||||||||||||||||||||||||
| 2712 | |||||||||||||||||||||||||||||||||||||||||||
| 2713 | B<example 1> | ||||||||||||||||||||||||||||||||||||||||||
| 2714 | |||||||||||||||||||||||||||||||||||||||||||
| 2715 | # given: synopsis; | ||||||||||||||||||||||||||||||||||||||||||
| 2716 | |||||||||||||||||||||||||||||||||||||||||||
| 2717 | my $result = $error ~~ 'Exception!'; | ||||||||||||||||||||||||||||||||||||||||||
| 2718 | |||||||||||||||||||||||||||||||||||||||||||
| 2719 | # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2720 | |||||||||||||||||||||||||||||||||||||||||||
| 2721 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2722 | |||||||||||||||||||||||||||||||||||||||||||
| 2723 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||
| 2724 | |||||||||||||||||||||||||||||||||||||||||||
| 2725 | Awncorp, C<awncorp@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||
| 2726 | |||||||||||||||||||||||||||||||||||||||||||
| 2727 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 2728 | |||||||||||||||||||||||||||||||||||||||||||
| 2729 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 2730 | |||||||||||||||||||||||||||||||||||||||||||
| 2731 | Copyright (C) 2022, Awncorp, C<awncorp@cpan.org>. | ||||||||||||||||||||||||||||||||||||||||||
| 2732 | |||||||||||||||||||||||||||||||||||||||||||
| 2733 | This program is free software, you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 2734 | the terms of the Apache license version 2.0. | ||||||||||||||||||||||||||||||||||||||||||
| 2735 | |||||||||||||||||||||||||||||||||||||||||||
| 2736 | =cut | ||||||||||||||||||||||||||||||||||||||||||