undef or scoping problem in modperl?

[prev] [thread] [next] [Date index for 2004/12/09]

From: Reenen C Kroukamp
Subject: undef or scoping problem in modperl?
Date: 13:25 on 09 Dec 2004
Hi,

I have a hash, %tt_vars which seems to retain information across calls to the
modperl script even though I undef it at the beginning of the script:

Here is the start of the script:

	use diagnostics;
	use strict;
	use Template;
	use CGI qw/:standard/;
	use DBI;
	use POSIX qw(strftime);
	use Socket qw( inet_aton inet_ntoa );
	use Time::Local;
	use Data::Dumper;

	my (%_conf, %tt_vars);

	$_conf{www_dir}  = '/var/www/servenet/';

	print header(-expires=>"-1d");

	undef %tt_vars;
	print STDERR "tt_vars (undef):\n" . Dumper(\%tt_vars) . "\n";

...
The dump of \%tt_vars here show that it is indeed undefed.
After checking passed parameters, I call a subroutine:
...

	&report_arpwatch('all');

#-- arpwatch report
sub report_arpwatch()
{   
    my $period = shift;
	my (%a, $dbh, $sql, $sth);
	print STDERR "tt_vars (report_arpwatch):\n" . Dumper(\%tt_vars) . "\n";

....
Dumping the variables show that the previous entries for %tt_vars are still
there. It looks like it may be related to this:

	my() Scoped Variable in Nested Subroutines
	http://perl.apache.org/docs/general/perl_reference/perl_reference.html#The_Poison

Though it is not being seen in a nested subroutine?

-R

        -- 
        Reenen C Kroukamp <reenen@xxxxxxx.xxx>
Qualica Technologies (Pty) Ltd
http://www.qualica.com/

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

undef or scoping problem in modperl?
Reenen C Kroukamp 13:25 on 09 Dec 2004

Re: undef or scoping problem in modperl?
Reenen C Kroukamp 13:35 on 09 Dec 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52