use constant ERROR => 1; use constant VERBOSE_ERROR => -1; use constant WARNING => 2; use constant VERBOSE_WARNING => -2; # Handles all output of errors/warnings, etc. sub output ($$) { my ($message, $level) = @_; if ( $error_flag && $level == ERROR ) { print "ERROR: $message\n"; } if ( $warning_flag && $level == WARNING ) { print "WARNING: $message\n"; } return; } #### { package State::Object; use Scalar::Util qw(refaddr); my %dses_name; my %first_name; my %last_name; my %mid_intial; my %internal_email; my %full_name; my %dn; my %display_name; my %line_address; sub DESTROY { my ($self) = @_; no warnings qw(uninitialized); if ( defined($first_name{$$self}) or defined($last_name{$$self}) or defined($mid_intial{$$self}) or defined($full_name{$$self}) or defined($display_name{$$self}) ) { &main::output("Record for: '".$dn{$$self}."' starting at line: ".$line_address{$$self}.' never ended.', 2); } delete $dses_name{$$self}; delete $dn{$$self}; delete $line_address{$$self}; } # Other object code ... }