--- loncom/interface/lonnavmaps.pm 2003/03/03 13:03:58 1.151 +++ loncom/interface/lonnavmaps.pm 2003/03/21 22:41:12 1.165 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.151 2003/03/03 13:03:58 www Exp $ +# $Id: lonnavmaps.pm,v 1.165 2003/03/21 22:41:12 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,8 +38,11 @@ # YEAR=2002 # 1/1 Gerd Kortemeyer # Oct-Nov Jeremy Bowers +# YEAR=2003 +# Jeremy Bowers ... lots of days package Apache::lonnavmaps; +use vars qw($test @refsToUntie); use strict; use Apache::Constants qw(:common :http); @@ -49,6 +52,7 @@ use POSIX qw (floor strftime); my %navmaphash; my %parmhash; +@refsToUntie; # symbolic constants sub SYMB { return 1; } @@ -96,8 +100,12 @@ my %colormap = # And a special case in the nav map; what to do when the assignment # is not yet done and due in less then 24 hours my $hurryUpColor = "#FF0000"; - +$test = 'abc'; sub cleanup { + &Apache::lonnet::logthis("Cleanup called."); + &Apache::lonnet::logthis("refs size".scalar(@refsToUntie)); + &Apache::lonnet::logthis("test is ".$test); + $test = '467'; if (tied(%navmaphash)){ &Apache::lonnet::logthis('Cleanup navmaps: navmaphash'); unless (untie(%navmaphash)) { @@ -110,6 +118,14 @@ sub cleanup { &Apache::lonnet::logthis('Failed cleanup navmaps: parmhash'); } } + # Apparently, if you take a reference to a tied hash, both the + # original hash and the tied hash must be untied. Bleh. + for my $ref (@refsToUntie) { + &Apache::lonnet::logthis('Cleanup navmaps: reference'); + unless (untie($ref)) { + &Apache::lonnet::logthis('Failed cleanup navmaps: reference'); + } + } } sub handler { @@ -141,7 +157,7 @@ sub real_handler { $r->send_http_header; # Create the nav map - my $navmap = Apache::lonnavmaps::navmap->new( + my $navmap = Apache::lonnavmaps::navmap->new($r, $ENV{"request.course.fn"}.".db", $ENV{"request.course.fn"}."_parms.db", 1, 1); @@ -156,6 +172,7 @@ sub real_handler { $r->print("