| 1 | # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- | ||||||||||
| 2 | # vim: ts=4 sts=4 sw=4: | ||||||||||
| 3 | package CPAN::Exception::yaml_process_error; | ||||||||||
| 4 | 24 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 24 | ▶ | use overload '""' => "as_string"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 24 | use vars qw( | |||||||||
| 8 | $VERSION | ||||||||||
| 9 | 24 | ▶ | ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 24 | $VERSION = "5.5"; | |||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | sub new { | ||||||||||
| 14 | 0 | ▶ | my($class,$module,$file,$during,$error) = @_; | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 15 | # my $at = Carp::longmess(""); # XXX find something more beautiful | ||||||||||
| 16 | 0 | bless { module => $module, | |||||||||
| 17 | file => $file, | ||||||||||
| 18 | during => $during, | ||||||||||
| 19 | error => $error, | ||||||||||
| 20 | # at => $at, | ||||||||||
| 21 | }, $class; | ||||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | sub as_string { | ||||||||||
| 25 | 0 | ▶ | my($self) = shift; | ||||||||
|
Subroutine
as_string: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 26 | 0 | ▶ | if ($self->{during}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | ▶ | if ($self->{file}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | ▶ | if ($self->{module}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | ▶ | if ($self->{error}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 0 | return "Alert: While trying to '$self->{during}' YAML file\n". | |||||||||
| 31 | " '$self->{file}'\n". | ||||||||||
| 32 | "with '$self->{module}' the following error was encountered:\n". | ||||||||||
| 33 | " $self->{error}\n"; | ||||||||||
| 34 | } else { | ||||||||||
| 35 | 0 | return "Alert: While trying to '$self->{during}' YAML file\n". | |||||||||
| 36 | " '$self->{file}'\n". | ||||||||||
| 37 | "with '$self->{module}' some unknown error was encountered\n"; | ||||||||||
| 38 | } | ||||||||||
| 39 | } else { | ||||||||||
| 40 | 0 | return "Alert: While trying to '$self->{during}' YAML file\n". | |||||||||
| 41 | " '$self->{file}'\n". | ||||||||||
| 42 | "some unknown error was encountered\n"; | ||||||||||
| 43 | } | ||||||||||
| 44 | } else { | ||||||||||
| 45 | 0 | return "Alert: While trying to '$self->{during}' some YAML file\n". | |||||||||
| 46 | "some unknown error was encountered\n"; | ||||||||||
| 47 | } | ||||||||||
| 48 | } else { | ||||||||||
| 49 | 0 | return "Alert: unknown error encountered\n"; | |||||||||
| 50 | } | ||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 24 | 1; | |||||||||