RE: [mp2] Also problems with reloading modules after upgrade

[prev] [thread] [next] [Date index for 2005/01/25]

From: Thomas den Braber
Subject: RE: [mp2] Also problems with reloading modules after upgrade
Date: 12:28 on 25 Jan 2005
Philippe,

The apache config looks like this (stripped version)

# main location for dynamic content
PerlRequire "/srv/config/httpd/modperl/sitegen2.start"
PerlSetVar custom_error "/public/autherror.htm"
<Location /start>
AuthName "deloswww"
	PerlSetVar Logout "/start"
	PerlSetVar Login "/loginform"
	PerlSetVar site deloswww
	PerlAuthenHandler siteAuth
	AuthType sitecookie
	Require valid-user
	AllowOverride None
	SetHandler perl-script
	PerlResponseHandler siteMain
	PerlInitHandler Apache::Reload
</Location>

sitegen2.start looks like this (stripped version)

#!/usr/bin/perl
use strict;

use lib qw( /srv/sitegen2/lib );  # Edit to match your installation
directory.

# apache modules
print "Starting Modperl\t\t";
use Apache2 ();
use ModPerl::Const qw( EXIT );
use ModPerl::Util (); # for CORE::GLOBAL::exit

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
use Apache::SubRequest ();

use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use Apache::Util ();
use Apache::Access ();

use APR::Table ();
use Apache::Request ();
use Apache::Upload ();
use ModPerl::Registry ();

use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';

use Apache::Reload ();

# site modules
use site.......
use site.......
........

print "[  OK  ]\n";

siteMain.pm looks like this (stripped version)

#!/usr/bin/perl

package siteMain;

# benchmarking modules
use Time::HiRes;
use Benchmark ':hireswallclock';

use strict;
use lib "./";
use vars qw ( %c %prefs);

# apache modperl modules
use Apache::RequestRec ();
use Apache::Response ();
use Apache::SubRequest ();
use Apache::RequestUtil ();
use Apache::Request;
use Apache::Cookie;
use Apache::Upload;
use Apache::Log;
use Apache::Const qw(:common);
use Apache::URI ();
use Template;
use Template::Constants qw( :debug );

# site modules
use siteDebug;
use siteUtil;
use siteAdmin;
use siteEdit;
use siteDB;
use siteContent;
use siteRights;
use siteHulpEdit;
use siteFiles;
use Menu2;
use siteCSS;
use siteSubmit;
use textEdit;  # sitegen text edit routines
use tieUri;	# dynamic generate newuri including parsings
use siteConfig;
use siteCache;
use siteSql;
use siteExplorer;
use siteProxy;
use fBrowse;
use siteDocuments;

use Data::Dumper;  # testing and debugging only
use Carp;      # testing and debugging only
use swsearch;

our %shared_prefs;
our %shared_config;
our %shared_alg;
our $template;

*c = \%siteConfig::c;		# Alias to %c in siteConfig.pm

sub handler {

	my $r = shift;

	my $output;
	$r->content_type('text/html');
	$c{site}=$r->dir_config('site')
	$c{r} = $r;

	&readconfig( "/srv/sitegen2/config/$c{site}.conf" );
	$c{config}=$shared_config{$c{site}};
	$c{prefs}=$shared_prefs{$c{site}};

	# read preferences per site
	&readprefs ( "/srv/sitegen2/config/$c{site}.prefs" );

	# connect to database
	$c{dbh} = &siteDB::connectDB;

	....

	# print main menu
	if ($printmenu){

		$output = &Menu2::Main();
		$r->print ($output);
	}

	# cleanup
	&cleanup;
  	return Apache::OK; # We must return a status to mod_perl
}
....

Menu2.pm looks like this (stripped version )

#!/usr/bin/perl

package Menu2;

use lib qw{ ./ };
use siteUtil;
use siteSql;
use menuNav;
use DBI;
use vars qw( %c );
use strict;
use Data::Dumper;  # testing en debugging only

use siteDebug;
use siteDB;
use siteContent;
use quickLinks;
use siteFiles;
use sitePlugins;

my $cvsrevision='$Revision: 1.23 $';
my $vdate='$Date: 2005/01/12 13:41:06 $';
my ($version)=($cvsrevision=~/:\s(.+)\s/);
$vdate =~ s#(.*\s(\d+)/(\d+)/(\d+).+)#$4-$3-$2#;

*c = \%siteConfig::c;		# Alias to %c in siteConfig.pm

sub Main {

	my $depth;
	my %t;
my $output;
	# make macros inactive
	$t{macro1_active} = 0;
	$t{macro2_active} = 0;

	# get site preferenses 
	#$prefs = &sitePrefs();

	my $menu = new menuNav();
	......
	Return (\$output)
}
.....

-----Oorspronkelijk bericht-----
Van: Philippe M. Chiasson [mailto:gozer@xxxxxxxxx.xxx] 
Verzonden: maandag 24 januari 2005 23:51
Aan: Thomas den Braber
CC: modperl@xxxx.xxxxxx.xxx
Onderwerp: Re: [mp2] Also problems with reloading modules after upgrade

> I hope this can help to locate the problem.
> 
> Regards,
> 
> Thomas den Braber
> 
>>-----Oorspronkelijk bericht-----
>>Van: Thomas den Braber [mailto:thomas@xxxxx.xx]
>>Verzonden: maandag 24 januari 2005 10:47
>>Aan: 'Thomas den Braber'; modperl@xxxx.xxxxxx.xxx
>>Onderwerp: RE: [mp2] Also problems with reloading modules after upgrade
>>
>>Finally I have some more info on this issue. I installed my modperl
>>handler
>>in a virtual host directive and now I see the Apache::Reload debug
>>messages.
>>I found out that there is a difference between reloading in 199_16 and the
>>version above 199_16:
>>
>>I changed the menu2.pm file.

Could you possibly post the content of menu2.pm as well as at least one of
the modules it 'uses' and doesn't seem to reload right ?

>> [...]

----------------------------------------------------------------------------
----
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID :
88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107
88C3A5A5


[mp2] Also problems with reloading modules after upgrade
Thomas den Braber 11:51 on 05 Jan 2005

Re: [mp2] Also problems with reloading modules after upgrade
Philippe M. Chiasson 22:50 on 24 Jan 2005

RE: [mp2] Also problems with reloading modules after upgrade
Thomas den Braber 12:28 on 25 Jan 2005

Generated at 17:42 on 27 Jan 2005 by mariachi v0.52