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 Re: 2.0b8: MailFormTo and strange crashes
Date Wed, 06 Nov 2002 12:27:36 GMT
Gerald Richter <richter@ecos.de> wrote:
> 
> > When I try to call MailFormTo I get the following error:
> >
> 
> This is already fixed in the cvs version. I send it to you per private mail

Thanks, this works just fine now!

> >
> > Another strange behavior (probably unrelated, but you never know): I
> notice that
> > when I have tried to use Embperl 2.x along with the old HTML::Embperl,
> Apache
> > would not start up if 2.x was declared before 1.x in startup.pl.
> 
> This may also work in the new version, but I am not sure

This one still happens with the cvs version. I am not sure why it would do this,
since I am no longer referencing the 1.x Embperl anywhere. I first noticed this
when I simply added the line 'use Embperl ();' just before the other lines for
use HTML::Embperl and use HTML::EmbperlObject in startup.pl. Just by simply
adding that one line (and not using 2.x anywhere, in any way), httpsd would not
start. Then it worked when I moved that line to AFTER the 1.x use lines. So then
I tried taking out all reference to 1.x, and removing the use lines for 1.x, and
apache then doesn't start again. No messages in any log files that I can see, so
I assume it's some kind of seqfault? Very mysterious...

Thanks again, Gerald, for all your help! 2.x looks really good, and I look
forward to getting my projects ported over to it. There's a lot of code in my
main project, and it looks like 2.x will make it easier to manage.

All the best,

-Neil

p.s. I forgot to include index.html in the examples for the other problem, with
strict. Just in case it matters, here it is:

[$ var $global $name $]
[* $global = shift; *]
[* $name = "Neil"; *]
[* $global->{core}->hello ($name); *]
[* $global->{core}->goodbye ($name); *]

And, for the sake of completeness, here's my startup.pl:

#!/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);

# 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,        # A pattern identifying files to be processed, e.g. '*.html
*.epl'
	@search_path     # List of paths for giving to 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 "Embperl::Execute $file\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;

> 
> Gerald
> 
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
> 
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 

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


Mime
View raw message