perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Gunton <neil.embp...@home.nilspace.com>
Subject 2.x Execute crash in startup.pl
Date Sat, 09 Nov 2002 20:05:13 GMT
Hi again Gerald,

Further adventures in converting to 2.x: I have a function in startup.pl which
preloads my Embperl pages, so that they will run in shared memory (as much as
possible). This works with Embperl 1.x, but causes apache to crash in
Embperl-2.0b9_dev-3. The error is as follows:

[root@dev src]# httpsdctl start
$path = :/www/vhosts/www.neilgunton.com/htdocs:/www/lib/perl/Apache/
Embperl::Execute body.html
[2783]ERR:  56: : Unknown Provider epcompile 
/usr/local/apache/bin/httpsdctl: line 171:  2783 Segmentation fault      $HTTPD
/usr/local/apache/bin/httpsdctl start: httpsd could not be started

The startup.pl is as follows (fails on the call to Embperl::Execute):

#!/usr/local/bin/perl

# First modify the include path
BEGIN
{
    use strict;
    use Apache ();
    use lib '/www/lib/perl';
}

# Common modules
use Apache::Registry ();
use Apache::Constants ();
use Apache::File ();
use Apache::Log ();
use Safe ();
use URI::Escape ();
use Log::Logger ();
use File::Copy ();
use File::Path ();
use File::Glob ();
use Time::Zone ();
use CGI qw (-compile :cookie cgi_error header);
use Date::Calc qw(:all);
use Image::Magick ();
#use HTML::Embperl ();
#use HTML::EmbperlObject ();
use Embperl ();
use Embperl::Object ();
use DBI ();
DBI->install_driver('mysql');
use Digest::HMAC_MD5 qw(hmac_md5_hex);
use SOAP::Lite ();

# My modules
use Apache::BlockAgent ();
use Apache::Nilspace::Main::Access ();
use Apache::Nilspace::Subscription::Access ();
use Apache::Nilspace::Subscription::Handler ();
use Nilspace ();
use Nilspace::Agenda ();
use Nilspace::Commerce ();
use Nilspace::Mail ();

# Apache::VMonitor
use Apache::VMonitor();
$Apache::VMonitor::Config{BLINKING} = 1;
$Apache::VMonitor::Config{REFRESH}  = 0;
$Apache::VMonitor::Config{VERBOSE}  = 0;
$Apache::VMonitor::Config{SYSTEM}   = 1;
$Apache::VMonitor::Config{APACHE}   = 1;
$Apache::VMonitor::Config{PROCS}    = 1;
$Apache::VMonitor::Config{MOUNT}    = 1;
$Apache::VMonitor::Config{FS_USAGE} = 1;
$Apache::VMonitor::Config{SORT_BY}  = 'size';
$Apache::VMonitor::PROC_REGEX = join "\|", qw(httpd mysql squid);

# Preload Embperl website code
#if (lc($ENV{PRELOAD_WEBSITES}) eq 'on')
{
    #preload_dir ('/www/lib/perl/Apache', '*.html *.epl');
    preload_dir ('/www/vhosts/www.neilgunton.com/htdocs', '*.html *.epl');
    #preload_dir ('/www/vhosts/www.crazyguyonabike.com/htdocs', '*.html *.epl');
}

# Recursive directory traversal sub which preloads Embperl files
sub preload_dir
{
    my ($dir,            # The current directory which is to be processed
	$pattern,        # Files to be processed, e.g. '*.html *.epl'
	@search_path     # List of paths for Embperl to search for files
	) = @_;

    @search_path = () if !@search_path;

    # Put the current dir on the search path
    push (@search_path, $dir);

    local *DIR;
    opendir (DIR, $dir) or die "Could not open directory: $dir: $!";

    # First, process files in this directory
    # Pattern consists of a potential list of patterns, separated by spaces.
    # First we make a list of patterns, and then glob each of these
    foreach my $glob (split (/\s/, $pattern))
    {
	# Iterate through the resulting list of files
	foreach my $file (File::Glob::glob ("$dir/$glob"))
	{
	    if (!(-d $file) && (-e $file))
	    {
		# Build up the paths, starting with the current dir and working
                # back up to the website root
		my $path = '';
		foreach my $i (1 .. scalar(@search_path))
		{
		    $path .= ':' . $search_path[scalar(@search_path) - $i];
		}
		$path .= ':/www/lib/perl/Apache/';
		$file =~ /\/([^\/]+)$/;
		my $filename = $1;
		print "\$path = $path\n";
		print "Embperl::Execute $filename\n";
		Embperl::Execute ({inputfile => $filename,
				   import => 0,
				   path => $path,
				   escmode => 0,
				   options => 16}) ;
	    }
	}
    }

    # Now, recursively go down into subdirectories
    while (defined(my $subdir = readdir (DIR)))
    {
	# Only recurse on directories, which do not start with ".", and skip 
        # symbolic links
	if (-d "$dir/$subdir" &&
	    !(-l "$dir/$subdir") &&
	    ($subdir !~ /^\.{1,2}$/))
	{
	    
	    preload_dir ("$dir/$subdir", $pattern, @search_path);
	}
    }
}

1;

Any ideas? Should I be doing this differently with 2.x?

TIA

-Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message