| 1 | 18 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 2 | 18 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | =head1 NAME | ||||||||||||
| 5 | |||||||||||||
| 6 | Config:Scoped::Error - an exception class hierarchy based on Error.pm for Config::Scoped | ||||||||||||
| 7 | |||||||||||||
| 8 | =head1 SYNOPSIS | ||||||||||||
| 9 | |||||||||||||
| 10 | use Config::Scoped::Error; | ||||||||||||
| 11 | |||||||||||||
| 12 | Config::Scoped::Error::Parse->throw( | ||||||||||||
| 13 | -text => $parser_error, | ||||||||||||
| 14 | -file => $config_file, | ||||||||||||
| 15 | -line => $thisline, | ||||||||||||
| 16 | ); | ||||||||||||
| 17 | |||||||||||||
| 18 | Config::Scoped::Error::IO->throw( | ||||||||||||
| 19 | -text => "can't open file: $!", | ||||||||||||
| 20 | -file => $config_file, | ||||||||||||
| 21 | -line => $thisline, | ||||||||||||
| 22 | ); | ||||||||||||
| 23 | |||||||||||||
| 24 | Config::Scoped::Error::Validate::Macro->throw( | ||||||||||||
| 25 | -text => "macro redefinition: $macro_name", | ||||||||||||
| 26 | -file => $config_file, | ||||||||||||
| 27 | -line => $thisline, | ||||||||||||
| 28 | ); | ||||||||||||
| 29 | |||||||||||||
| 30 | =head1 DESCRIPTION | ||||||||||||
| 31 | |||||||||||||
| 32 | Config::Scoped::Error is a class hierarchy based on Error.pm. The following Exception class hierarchy is defined: | ||||||||||||
| 33 | |||||||||||||
| 34 | Config::Scoped::Error | ||||||||||||
| 35 | |||||||||||||
| 36 | Config::Scoped::Error::Parse | ||||||||||||
| 37 | |||||||||||||
| 38 | Config::Scoped::Error::Validate | ||||||||||||
| 39 | |||||||||||||
| 40 | Config::Scoped::Error::Validate::Macro | ||||||||||||
| 41 | |||||||||||||
| 42 | Config::Scoped::Error::Validate::Parameter | ||||||||||||
| 43 | |||||||||||||
| 44 | Config::Scoped::Error::Validate::Declaration | ||||||||||||
| 45 | |||||||||||||
| 46 | Config::Scoped::Error::Validate::Permissions | ||||||||||||
| 47 | |||||||||||||
| 48 | Config::Scoped::Error::IO | ||||||||||||
| 49 | |||||||||||||
| 50 | =cut | ||||||||||||
| 51 | |||||||||||||
| 52 | package Config::Scoped::Error; | ||||||||||||
| 53 | 18 | ▶ | use base 'Error'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 54 | 18 | our $VERSION='0.22'; | |||||||||||
| 55 | |||||||||||||
| 56 | #Error propagation, see perldoc -f die | ||||||||||||
| 57 | 0 | ▶ | sub PROPAGATE { | ||||||||||
|
Subroutine
PROPAGATE: not called CC=1 SCAR=0.6
Pod
undocumented
| |||||||||||||
| 58 | 18 | ▶ | no warnings 'uninitialized'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 59 | 0 | $_[0]->{-propagate} .= "propagated at $_[1] line $_[2]\n"; | |||||||||||
| 60 | 0 | return $_[0]; | |||||||||||
| 61 | } | ||||||||||||
| 62 | |||||||||||||
| 63 | # private accessor | ||||||||||||
| 64 | 20 | ▶ | sub _propagate { | ||||||||||
|
Subroutine
_propagate: called CC=2 SCAR=7.6
| |||||||||||||
| 65 | 20 | ▶ | return exists $_[0]->{-propagate} ? $_[0]->{-propagate} : undef; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 66 | } | ||||||||||||
| 67 | |||||||||||||
| 68 | # Override Error::stringify. | ||||||||||||
| 69 | # Add the file and line if not ending in a newline and | ||||||||||||
| 70 | # add the propagated text. | ||||||||||||
| 71 | 20 | ▶ | sub stringify { | ||||||||||
|
Subroutine
stringify: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 72 | 18 | ▶ | no warnings 'uninitialized'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 73 | 20 | my $file = $_[0]->file; | |||||||||||
| 74 | 20 | my $line = $_[0]->line; | |||||||||||
| 75 | 20 | ▶ | my $propagate = $_[0]->_propagate || ''; | ||||||||||
|
Condition50%1/2
$_[0]->_propagate || ''
MC/DC0%0/1
$_[0]->_propagate || ''
$_[0]->_propagate
Truth table50%1/2
A
A= $_[0]->_propagate
| |||||||||||||
| 76 | |||||||||||||
| 77 | 20 | my $text = $_[0]->SUPER::stringify; | |||||||||||
| 78 | |||||||||||||
| 79 | 20 | ▶ | $text .= " at $file line $line.\n" | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 80 | unless ( $text =~ /\n$/s ); | ||||||||||||
| 81 | |||||||||||||
| 82 | 20 | $text .= $propagate; | |||||||||||
| 83 | |||||||||||||
| 84 | 20 | return $text; | |||||||||||
| 85 | } | ||||||||||||
| 86 | |||||||||||||
| 87 | package Config::Scoped::Error::Parse; | ||||||||||||
| 88 | 18 | ▶ | use base 'Config::Scoped::Error'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 89 | 18 | our $VERSION='0.22'; | |||||||||||
| 90 | |||||||||||||
| 91 | package Config::Scoped::Error::IO; | ||||||||||||
| 92 | 18 | ▶ | use base 'Config::Scoped::Error'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 93 | 18 | our $VERSION='0.22'; | |||||||||||
| 94 | |||||||||||||
| 95 | package Config::Scoped::Error::Validate; | ||||||||||||
| 96 | 18 | ▶ | use base 'Config::Scoped::Error'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 97 | 18 | our $VERSION='0.22'; | |||||||||||
| 98 | |||||||||||||
| 99 | package Config::Scoped::Error::Validate::Macro; | ||||||||||||
| 100 | 18 | ▶ | use base 'Config::Scoped::Error::Validate'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 101 | 18 | our $VERSION='0.22'; | |||||||||||
| 102 | |||||||||||||
| 103 | package Config::Scoped::Error::Validate::Parameter; | ||||||||||||
| 104 | 18 | ▶ | use base 'Config::Scoped::Error::Validate'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 105 | 18 | our $VERSION='0.22'; | |||||||||||
| 106 | |||||||||||||
| 107 | package Config::Scoped::Error::Validate::Declaration; | ||||||||||||
| 108 | 18 | ▶ | use base 'Config::Scoped::Error::Validate'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 109 | 18 | our $VERSION='0.22'; | |||||||||||
| 110 | |||||||||||||
| 111 | package Config::Scoped::Error::Validate::Permissions; | ||||||||||||
| 112 | 18 | ▶ | use base 'Config::Scoped::Error::Validate'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 113 | 18 | our $VERSION='0.22'; | |||||||||||
| 114 | |||||||||||||
| 115 | 18 | 1; | |||||||||||
| 116 | |||||||||||||
| 117 | =head1 SEE ALSO | ||||||||||||
| 118 | |||||||||||||
| 119 | Config::Scoped, Error | ||||||||||||
| 120 | |||||||||||||
| 121 | =head1 AUTHOR | ||||||||||||
| 122 | |||||||||||||
| 123 | Karl Gaissmaier E<lt>karl.gaissmaier at uni-ulm.deE<gt> | ||||||||||||
| 124 | |||||||||||||
| 125 | =head1 COPYRIGHT AND LICENSE | ||||||||||||
| 126 | |||||||||||||
| 127 | Copyright (c) 2004-2008 by Karl Gaissmaier | ||||||||||||
| 128 | |||||||||||||
| 129 | This library is free software; you can redistribute it and/or modify | ||||||||||||
| 130 | it under the same terms as Perl itself. | ||||||||||||
| 131 | |||||||||||||
| 132 | =cut | ||||||||||||
| 133 | |||||||||||||
| 134 | # vim: cindent sm nohls sw=4 sts=4 ruler | ||||||||||||
| 135 | |||||||||||||