File Coverage

blib/lib/CPAN/Exception/yaml_process_error.pm
Criterion Covered Total %
statement 9 21 42.8
branch 0 8 0.0
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 12 36 33.3


line stmt bran cond sub pod time code
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 12     12   49 use strict;
  12         13  
  12         428  
5 12     12   54 use overload '""' => "as_string";
  12         13  
  12         59  
6              
7 12         3184 use vars qw(
8             $VERSION
9 12     12   652 );
  12         22  
10             $VERSION = "5.5";
11              
12              
13             sub new {
14 0     0 0   my($class,$module,$file,$during,$error) = @_;
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     0 0   my($self) = shift;
26 0 0         if ($self->{during}) {
27 0 0         if ($self->{file}) {
28 0 0         if ($self->{module}) {
29 0 0         if ($self->{error}) {
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             1;