| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Geoffrey::Exception::General; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 8 |  |  | 8 |  | 58 | use utf8; | 
|  | 8 |  |  |  |  | 20 |  | 
|  | 8 |  |  |  |  | 49 |  | 
| 4 | 8 |  |  | 8 |  | 344 | use 5.016; | 
|  | 8 |  |  |  |  | 29 |  | 
| 5 | 8 |  |  | 8 |  | 42 | use strict; | 
|  | 8 |  |  |  |  | 26 |  | 
|  | 8 |  |  |  |  | 185 |  | 
| 6 | 8 |  |  | 8 |  | 42 | use warnings; | 
|  | 8 |  |  |  |  | 13 |  | 
|  | 8 |  |  |  |  | 281 |  | 
| 7 | 8 |  |  | 8 |  | 44 | use Carp qw/longmess/; | 
|  | 8 |  |  |  |  | 13 |  | 
|  | 8 |  |  |  |  | 988 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | $Geoffrey::Exception::General::VERSION = '0.000205'; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | use Exception::Class 1.23 ( | 
| 12 | 8 |  |  |  |  | 96 | 'Geoffrey::Exception::General'                   => { description => 'Unidentified exception', }, | 
| 13 |  |  |  |  |  |  | 'Geoffrey::Exception::General::TableNameMissing' => { description => 'No default value set for column in table!', }, | 
| 14 |  |  |  |  |  |  | 'Geoffrey::Exception::General::UnknownAction'    => { description => 'No default value set for column in table!', }, | 
| 15 |  |  |  |  |  |  | 'Geoffrey::Exception::General::ParamsMissing'    => { description => 'The sub needs some params!', }, | 
| 16 |  |  |  |  |  |  | 'Geoffrey::Exception::General::WrongRef'         => { description => 'The sub needs a ref!', }, | 
| 17 |  |  |  |  |  |  | 'Geoffrey::Exception::General::Eval'             => { description => 'Eval exception!', }, | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 8 |  |  | 8 |  | 57 | ); | 
|  | 8 |  |  |  |  | 171 |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | sub throw_wrong_ref { | 
| 22 | 8 |  |  | 8 | 1 | 24 | my ( $s_sub, $s_type ) = @_; | 
| 23 | 8 |  |  |  |  | 108 | return Geoffrey::Exception::General::WrongRef->throw( "$s_sub needs a $s_type\n" . longmess ); | 
| 24 |  |  |  |  |  |  | } | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | sub throw_no_table_name { | 
| 27 | 4 |  |  | 4 | 1 | 9 | my ($s_throw_message) = @_; | 
| 28 | 4 |  |  |  |  | 53 | return Geoffrey::Exception::General::TableNameMissing->throw( | 
| 29 |  |  |  |  |  |  | "I can't guess the table $s_throw_message\n" . longmess ); | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | sub throw_unknown_action { | 
| 33 | 4 |  | 50 | 4 | 1 | 14 | my $s_throw_message = shift // q//; | 
| 34 | 4 |  |  |  |  | 39 | return Geoffrey::Exception::General::UnknownAction->throw( | 
| 35 |  |  |  |  |  |  | "Key for action $s_throw_message not found or implemented.\n Probaply misspelled.\n" . longmess ); | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | sub throw_no_params { | 
| 39 | 1 |  | 50 | 1 | 1 | 6 | my $s_throw_message = shift // q//; | 
| 40 | 1 |  |  |  |  | 3 | my $s_param         = shift; | 
| 41 | 1 |  |  |  |  | 1 | my $hr_params       = shift; | 
| 42 | 1 | 50 |  |  |  | 4 | if ($s_param) { | 
| 43 | 0 |  |  |  |  | 0 | return Geoffrey::Exception::General::ParamsMissing->throw( | 
| 44 |  |  |  |  |  |  | qq~The sub "$s_throw_message" needs param: '$s_param'\n~ . longmess ); | 
| 45 |  |  |  |  |  |  | } | 
| 46 | 1 | 50 |  |  |  | 4 | if ($hr_params) { | 
| 47 | 0 |  |  |  |  | 0 | require Data::Dumper; | 
| 48 | 0 |  |  |  |  | 0 | my $s_params = Data::Dumper->new( [$hr_params] )->Terse(1)->Deparse(1)->Sortkeys(1)->Dump; | 
| 49 | 0 |  |  |  |  | 0 | return Geoffrey::Exception::General::ParamsMissing->throw( | 
| 50 |  |  |  |  |  |  | qq~The sub "$s_throw_message" needs param: '$s_param'!\n$s_params\n~ . longmess ); | 
| 51 |  |  |  |  |  |  | } | 
| 52 | 1 |  |  |  |  | 20 | return Geoffrey::Exception::General::ParamsMissing->throw( | 
| 53 |  |  |  |  |  |  | qq~The sub "$s_throw_message" needs some params.\n~ . longmess ); | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | sub throw_eval { | 
| 57 | 2 |  | 50 | 2 | 1 | 10 | my $s_throw_message = shift // q//; | 
| 58 | 2 |  |  |  |  | 36 | return Geoffrey::Exception::General::Eval->throw( qq~Eval exception with $s_throw_message.\n~ . longmess ); | 
| 59 |  |  |  |  |  |  | } | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | 1; | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | __END__ |