From 8fade0f1d5dcd53a18db7a30101694093e5e3f67 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sat, 14 Jan 2006 00:50:50 +0000 Subject: [PATCH] Fix syntax error inside ErrorHandler. Add DESTROY method to Config.pm Change Session::close so that it doesn't destroy things that don't exist (like _server) and destroys the logger last so we can log all errors. --- lib/WebGUI/Config.pm | 5 ++++- lib/WebGUI/Session.pm | 8 ++++++-- lib/WebGUI/Session/ErrorHandler.pm | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/WebGUI/Config.pm b/lib/WebGUI/Config.pm index 774bd4eb1..c1409a510 100644 --- a/lib/WebGUI/Config.pm +++ b/lib/WebGUI/Config.pm @@ -186,7 +186,10 @@ sub readAllConfigs { return \%configs; } - +sub DESTROY { + my ($self) = @_; + undef $self; +} 1; diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index bbfe0585a..09a9696ae 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -34,7 +34,7 @@ use WebGUI::Session::Stow; use WebGUI::Session::Style; use WebGUI::Session::Url; use WebGUI::Session::Var; - +use Data::Dumper; =head1 NAME @@ -113,9 +113,13 @@ Cleans up a WebGUI session information from memory and disconnects from any reso sub close { my $self = shift; + ##Must destroy the logger last! + my %keys = grep { $_ ne '_errorHandler' } keys %{ $self }; foreach my $object (keys %{$self}) { - $self->{$object}->DESTROY; + ##Don't destroy things that don's exist + $self->{$object} and $self->{$object}->DESTROY; } + $self->{_errorHandler} and $self->{_errorHandler}->DESTROY; undef $self; } diff --git a/lib/WebGUI/Session/ErrorHandler.pm b/lib/WebGUI/Session/ErrorHandler.pm index 6dc2a337e..6c1f27862 100644 --- a/lib/WebGUI/Session/ErrorHandler.pm +++ b/lib/WebGUI/Session/ErrorHandler.pm @@ -379,7 +379,7 @@ sub warn { my $self = shift; my $message = shift; $self->getLogger->warn($message); - $self->{_session}->stow->set("debug_warn") = $self->{_session}->stow->get("debug_warn").$message."\n"; + $self->{_session}->stow->set("debug_warn", $self->{_session}->stow->get("debug_warn").$message."\n"); }