[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code Serialization and mod_perl



On Oct 5, 2006, at 2:56 PM, Craig Tussey wrote:
How does Perl with mod_perl handle this. Are there any
important differences with the only Perl situation.
Might the dataspaces be corrupted? How does this work?

variables will persist through  every connection...

so 'use strict()' and specifically declare every variable with my / our as appropriate

ie:

my $connected= 0;
sub connect {
	my $connection= 'dbi connection';
	$connected++;
	return $connection
}
sub handler{
	my $r= shift
	if ( ! $connection ) {
		$connection= connect()
	}
	print $connected;
}

the first time you run that, you'll call connect and increment connected, which is local to the package. the second time though, $connection will have been set within the handler block

and then everything that David Nicol said


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.