perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reenen C Kroukamp <>
Subject undef or scoping problem in modperl?
Date Thu, 09 Dec 2004 13:25:30 GMT

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:


#-- 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

Though it is not being seen in a nested subroutine?


Reenen C Kroukamp <>
Qualica Technologies (Pty) Ltd

Report problems:
Mail list info:
List etiquette:

View raw message