| 1 | package API::Docker::Error::Stream; | ||
| 2 | # ABSTRACT: Failure reported inside a Docker Engine progress stream | ||
| 3 | 52 | our $VERSION = '0.006'; | |
| 4 | 52 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | # namespace::clean has to come BEFORE "use overload" here, not after it as | ||
| 6 | # everywhere else in this distribution. It sweeps the symbols `overload` | ||
| 7 | # installs -- the `("" ` slot among them -- so with the two lines in the | ||
| 8 | # house order the class ends up not overloaded at all and stringifies as | ||
| 9 | # API::Docker::Error::Stream=HASH(0x...). Nothing dies when that happens: | ||
| 10 | # every caller that only inspects $@ as a string silently starts seeing a | ||
| 11 | # reference address instead of the reason. Measured, not assumed: | ||
| 12 | # overload::Overloaded($err) is false with the lines swapped. | ||
| 13 | 52 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | use overload | ||
| 15 | 21 | ▶ | '""' => sub { $_[0]->as_string }, |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 16 | 4 | ▶ | 'bool' => sub { 1 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 17 | 52 | fallback => 1; | |
| 18 | |||
| 19 | |||
| 20 | 52 | has message => ( | |
| 21 | is => 'ro', | ||
| 22 | required => 1, | ||
| 23 | ); | ||
| 24 | |||
| 25 | |||
| 26 | has events => ( | ||
| 27 | is => 'ro', | ||
| 28 | 0 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 29 | 52 | ); | |
| 30 | |||
| 31 | |||
| 32 | has location => ( | ||
| 33 | is => 'ro', | ||
| 34 | 0 | ▶ | default => sub { '' }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 35 | 52 | ); | |
| 36 | |||
| 37 | |||
| 38 | 21 | ▶ | sub as_string { $_[0]->message . $_[0]->location } |
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | 52 | 1; | |
| 43 | |||
| 44 | __END__ | ||