| 1 | # Error object for RPC::Switch::Client::Tiny | ||||||||||
| 2 | # | ||||||||||
| 3 | package RPC::Switch::Client::Tiny::Error; | ||||||||||
| 4 | |||||||||||
| 5 | 22 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 22 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 22 | our $VERSION = 1.1; | |||||||||
| 9 | |||||||||||
| 10 | 77 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 11 | 77 | my ($class, $type, $message, $extra) = @_; | |||||||||
| 12 | 77 | ▶ | return bless({type => $type, message => $message, $extra ? %$extra : ()}, $class); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | } | ||||||||||
| 14 | 22 | ▶ | use overload 'fallback' => 1, '""' => 'stringify'; # allow to print object as "$err" | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 134 | ▶ | sub stringify { | ||||||||
|
Subroutine
stringify: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 17 | 134 | my ($self) = @_; | |||||||||
| 18 | 134 | return "$self->{type} error: $self->{message}"; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 22 | 1; | |||||||||
| 22 | |||||||||||
| 23 | __END__ | ||||||||||