#------------------------------------- # PACKAGE INFO package Error; $VERSION = .3; use Exporter (); @ISA = qw(Exporter); @EXPORT = qw( csWarn csDie csErrorClass csErrorScale ErrorScaleName ErrorClassName); #------------------------------------- # PRAGMAS use lib 'f:/projects/site/bin/config/'; use strict; use utf8; #------------------------------------- # IN HOUSE MODULES use csLogsConfig qw( csErrorLog ); #================================================== #Error Constants my %ErrorClasses = ( ... ); my %ErrorScale = ( ... ); #-------------------------------------------------- # Accessors sub csErrorClass { return $ErrorClasses{$_[0]}; } sub ErrorClassName { foreach my $key ( keys %ErrorClasses ) { return $key if $ErrorClasses{$key} == $_[0]; } return 'UNKNOWN'; } sub csErrorScale { return $ErrorScale{$_[0]}; } sub ErrorScaleName { foreach my $key ( keys %ErrorScale ) { return $key if $ErrorScale{$key} == $_[0]; } return 'UNKNOWN'; } #================================================== # Replacements for User-called warn and die ...where we define csWarn and csDie... #================================================== # Private Functions ... more yummy subs ... #================================================== #Overload SIGWARN and SIGDIE ... to behave like csWarn and csDie with default values, wrapped in BEGIN ... #---- 1;