mod_perl a reloadovani modulu

Honza Pazdziora adelton na fi.muni.cz
Pondělí Duben 10 15:07:22 MEST 2006


On Mon, Apr 10, 2006 at 02:35:00PM +0200, Jan Kasprzak wrote:
> 
> Kdyz to testapp.pl parkrat spustim, a pak zmenim cislo ktere vraci
> test_fun(), tak pri dalsich spustenich ta aplikace vzdy na prvnim
> radku vraci korektni (aktualni) hodnotu, ale druhy radek nekdy obsahuje
> starou hodnotu a nekdy novou. Vyzkousel jsem, ze se to deje nejen pro
> @EXPORT, ale i pro @EXPORT_OK.
> 
> 	Napada nekoho, co je spatne? Diky,

man Apache2::Reload rika:

[...]

	Even though My/Utils.pm was reloaded, ModPerl::Registry's
	cached code won't run 'use My::Utils;' again (since it happens
	only once, i.e. during the compile time). Therefore the script
	doesn't know that the subroutine reference has been changed.

[...]

	Solution 1: replace use() with an explicit require() +
	import().

[...]

	Solution 2: remember to touch the script itself every time
	you change the module that it requires.

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton na fi.muni.cz | http://www.fi.muni.cz/~adelton/
 .project: Perl, mod_perl, DBI, Oracle, large Web systems, XML/XSL, ...
		Only self-confident people can be simple.


Další informace o konferenci Perl