perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reenen C Kroukamp <reen...@discovery.co.za>
Subject undef or scoping problem in modperl?
Date Thu, 09 Dec 2004 13:25:30 GMT
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@qualica.com>
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


Mime
View raw message