Re: Why is Apache::PerlRun a subclass of Apache?

2000-08-23 Thread Ken Williams

 ... *crickets* ...

Here's a patch for the implementation I'm looking for.  It passes the
'make test' stuff in CVS.  I'd love to see this change done, or a
discussion of why it's not a good idea.

Patch pasted below.

[EMAIL PROTECTED] (Ken Williams) wrote:
>Hi,
>
>I've got to ask this because I'm going through immense pain and
>suffering* dealing with this problem.  Why is Apache::PerlRun a subclass
>of Apache?  Shouldn't it just be a regular content handler that 'has-a'
>$r instead of 'is-a' Apache request?
>
>The problem I'm having is that I'm trying to write Apache::Filter as a
>subclass of Apache (because it 'is-a' Apache request class, in that it
>extends the Apache class), but PerlRun and its derived class RegistryNG
>step in and clobber $r.
>
>So I'm trying to open the discussion about whether the current implementation
>of Apache::PerlRun might be changeable.  I'm about to take a stab at
>implementing it the way I think (for the moment) it should be.
>
>-Ken
>
>   *Well, perhaps not actual pain and suffering, but I just watched "Buffy
>   the Vampire Slayer" so it's on my mind. =)



Index: PerlRun.pm
===
RCS file: /home/cvspublic/modperl/lib/Apache/PerlRun.pm,v
retrieving revision 1.29
diff -u -r1.29 PerlRun.pm
--- PerlRun.pm  2000/06/01 21:07:56 1.29
+++ PerlRun.pm  2000/08/24 06:32:53
@@ -19,32 +19,22 @@
 $Debug ||= 0;
 my $Is_Win32 = $^O eq "MSWin32";
 
-@Apache::PerlRun::ISA = qw(Apache);
-
 sub new {
 my($class, $r) = @_;
-return $r unless ref($r) eq "Apache";
-if(ref $r) {
-   $r->request($r);
-}
-else {
-   $r = Apache->request;
-}
 my $filename = $r->filename;
 $r->warn("Apache::PerlRun->new for $filename in process $$")
if $Debug && $Debug & 4;
 
-bless {
-   '_r' => $r,
-}, $class;
+return bless {}, $class;
 }
 
 sub can_compile {
 my($pr) = @_;
-my $filename = $pr->filename;
-if (-r $filename && -s _) {
-   if (!($pr->allow_options & OPT_EXECCGI)) {
-   $pr->log_reason("Options ExecCGI is off in this directory",
+my $r = Apache->request;
+my $filename = $r->filename;
+if (-r $r->finfo && -s _) {
+   if (!($r->allow_options & OPT_EXECCGI)) {
+   $r->log_reason("Options ExecCGI is off in this directory",
   $filename);
return FORBIDDEN;
}
@@ -52,7 +42,7 @@
return DECLINED;
}
unless (-x _ or $Is_Win32) {
-   $pr->log_reason("file permissions deny server execution",
+   $r->log_reason("file permissions deny server execution",
   $filename);
return FORBIDDEN;
}
@@ -64,8 +54,7 @@
 }
 
 sub mark_line {
-my($pr) = @_;
-my $filename = $pr->filename;
+my $filename = Apache->request->filename;
 return $Apache::Registry::MarkLine ?
"\n#line 1 $filename\n" : "";
 }
@@ -114,14 +103,15 @@
 sub compile {
 my($pr, $eval) = @_;
 $eval ||= $pr->{'sub'};
-$pr->clear_rgy_endav;
-$pr->log_error("Apache::PerlRun->compile") if $Debug && $Debug & 4;
+my $r = Apache->request;
+$r->clear_rgy_endav;
+$r->log_error("Apache::PerlRun->compile") if $Debug && $Debug & 4;
 Apache->untaint($$eval);
 {
no strict; #so eval'd code doesn't inherit our bits
eval $$eval;
 }
-$pr->stash_rgy_endav;
+$r->stash_rgy_endav;
 return $pr->error_check;
 }
 
@@ -145,7 +135,7 @@
 }
 
 if($errsv) {
-   $pr->log_error($errsv);
+   Apache->request->log_error($errsv);
return SERVER_ERROR;
 }
 
@@ -153,24 +143,25 @@
 }
 
 sub status {
-shift->{'_r'}->status;
+Apache->request->status;
 }
 
 sub namespace_from {
 my($pr) = @_;
+my $r = Apache->request;
 
-my $uri = $pr->uri; 
+my $uri = $r->uri;
 
-$pr->log_error(sprintf "Apache::PerlRun->namespace escaping %s",
+$r->log_error(sprintf "Apache::PerlRun->namespace escaping %s",
  $uri) if $Debug && $Debug & 4;
 
-my $path_info = $pr->path_info;
+my $path_info = $r->path_info;
 my $script_name = $path_info && $uri =~ /$path_info$/ ?
substr($uri, 0, length($uri)-length($path_info)) :
$uri;
 
-if ($Apache::Registry::NameWithVirtualHost && $pr->server->is_virtual) {
-   my $name = $pr->get_server_name;
+if ($Apache::Registry::NameWithVirtualHost && $r->server->is_virtual) {
+   my $name = $r->get_server_name;
$script_name = join "", $name, $script_name if $name;
 }
 
@@ -200,7 +191,7 @@
  
 $root ||= "Apache::ROOT";
 
-$pr->log_error("Apache::PerlRun->namespace: package $root$script_name")
+Apache->request->log_error("Apache::PerlRun->namespace: package 
+$root$script_name")
if $Debug && $Debug & 4;
 
 $pr->{'namespace'} = $root.$script_name;
@@ -209,13 +200,13 @@
 
 sub readscript {
 my $pr = shift;
-$pr->{'code'} = $pr->slurp_filename;
+ 

Patch to t/modules/request.t

2000-08-23 Thread Ken Williams

The following patch eliminates a warning during 'make test' about 'Value
of  construct can be "0";'.  No biggie, but it should be fixed.


--- t/modules/request.t 2000/05/12 03:43:24 1.8
+++ t/modules/request.t 2000/08/24 06:07:40
@@ -125,7 +125,7 @@
 my $lines = 0;
 local *FH;
 open FH, $file or die "open $file $!";
-++$lines while (my $dummy = );
+++$lines while ;
 close FH;
 my(@headers);
 if ($Is_dougm) {



Also: this test tests Apache::Request, but it's only run if the current
user is 'dougm'.  Is it time to let this test out of the cat-bag?  =)






STDIN and subrequests

2000-08-23 Thread Alex Menendez

hello, all

I am currently trying to have a cgi execute in a mod_perl module by
generating a subrequest to the executable via
lookup_uri. It is working great for GET requests. However, POST requests
are obviously failing because only the uri is being passed to the
subrequest and not the main request's STDIN. I assume the answer is to
tie the main request's STDIN to the subrequest's STDIN. I have tried to
to this with tie but I get an error because the subclass
Apache::SubRequest cannot execute a tie.

Any ideas?

-amen




Re: executing a cgi from within a handler (templating redux)

2000-08-23 Thread Todd Finney

At 02:11 PM 8/23/00, Perrin Harkins wrote:
>On Wed, 23 Aug 2000, Todd Finney wrote:
> > We were looking for a way to do only templating, and 
> leave
> > (essentially)  everything else on the site alone.
>
>For that, Template Toolkit, HTML::Template, or 
>CGI::FastTemplate are
>probably your best options.

As I said, Template::Toolkit is nice, but more tool than we 
need.  I'll have to investigate the last two.

> > Almost, but we still have a couple of concerns about
> > it.  First, it would mean that we'd have to update all 
> the
> > cgis to not use CGI.pm for form argument handling.
>
>You mean for HTML generation and "sticky" forms?  You can 
>still use CGI.pm
>for that with Template Toolkit and I think you can with 
>Mason as
>well.  Take a look at the mail archives.

The CGI.pm concern was specifically related to Mason.  See 
my reply to Matt for a link to the FAQ to which I was 
referring.

> > Second, we need to be able to do per-user templates, 
> which I don't
> > believe it can do (can AxKit do that?).
>
>You can modify the template path at run time with any of 
>these, which
>should do the trick.

I didn't realize that was so basic a requirement, but I 
suppose it would be handy in a lot of situations.

thanks,
Todd





Re: executing a cgi from within a handler (templating redux)

2000-08-23 Thread Todd Finney

At 03:00 PM 8/23/00, Matt Sergeant wrote:
>On Wed, 23 Aug 2000, Todd Finney wrote:
> > Almost, but we still have a couple of concerns about
> > it.  First, it would mean that we'd have to update all 
> the
> > cgis to not use CGI.pm for form argument handling.
>
>I doubt thats true - CGI.pm just gets its input from the 
>querystring or
>STDIN, so it should be able to intercept that in time, I 
>think.

Perhaps I misread the FAQ.

http://www.masonhq.com/docs/faq/#Should_I_use_CGI_pm_to_read_GET_


> >  Second,
> > we need to be able to do per-user templates, which I 
> don't
> > believe it can do (can AxKit do that?).
>
>Well I'm not sure exactly *how* per-user you want it. For 
>example is that
>1000 users and 1000 templates? But yes, it can certainly 
>do custom
>templates on a per-request basis. Thats a very basic 
>requirement. Just use
>named templates and a StyleChooser module of your making.

Cool.  Realistically, we need only 5-10 master templates 
from which to choose for each user.  I'll make sure we take 
a good look at AxKit if we ever get around to a change.

Thanks again.

cheers,
Todd




Re: Apache::Icon fix

2000-08-23 Thread George Sanderson

Update:
Apache/1.3.12 (Unix) mod_perl/1.24_01-dev/Perl-5.6.0/linux-2.2.14.
(mod_perl linked statically.) with Icon.pm.

I hope I am not bugging anyone with my problem and I appreciate any help.

I have made some progress isolating the problem.  

With a minimal config. (with only Apache::Icon loaded), it's directives are
not recognized after:
 "kill -HUP httpd-pid"  

The error_log.test output was:
Syntax error on line 17 of /usr/local/apache/conf/httpd.try:
Invalid command 'AddIconByEncoding', perhaps mis-spelled or defined by a
module not included in the server configuration

Hence the httpd (apache) processes terminate.

If I comment out all of the Icon directives, the SIGHUP works.

Of course, when I just launch httpd for the first time, every thing is fine.
Here is my minimal httpd.conf file:

LoadModule config_log_modulelibexec/mod_log_config.so
LoadModule access_modulelibexec/mod_access.so
LoadModule dir_module   libexec/mod_dir.so
ClearModuleList
AddModule mod_log_config.c
AddModule mod_dir.c
AddModule mod_access.c
AddModule mod_so.c
AddModule mod_perl.c
DocumentRoot /home/httpd/test/htdocs
DirectoryIndex index.html index.htm index.shtml index.cgi Default.htm
default.htm
PerlModule Apache::Icon
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/tar.gif .tar
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/text.gif .txt
DefaultIcon /icons/unknown.gif
#
ServerType standalone
Port 81
HostnameLookups off
User webuser
Group webgroup
ServerAdmin [EMAIL PROTECTED]
ServerRoot /usr/local/apache
ErrorLog logs/error_log.test
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog logs/access_log.test combined
PidFile logs/httpd.pid.test
ScoreBoardFile logs/httpd.scoreboard.test
LockFile logs/httpd.lock.test
ServerName test.xorgate.com
UseCanonicalName on
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 4
MaxSpareServers 10
StartServers 6
MaxClients 50
MaxRequestsPerChild 200








make test error (followup)

2000-08-23 Thread Christopher Everett

I've been advised to follow up with more compilation and
os/compiler/hardware/etc info ASAP so here it is:

OS:   Linux 2.2.17 (debian)
compiler: gcc 2.95.2
make: Gnu make v. 3.78.1
ldGnu ld 2.9.5

Hardware: Pentium-166, 96 MB RAM

I'm following the instructions from the guide for a mod_perl install
with a lightweight front-end with shared libs & document roots, so
I de-tar mod_perl-1.24 and apache_1.3.12 under /usr/src/httpd_perl/.

I put a modified config.layout into apache_1.3.12 where I modified the 
Redhat layout to suit:

# my layout

prefix:/usr/local
exec_prefix:   $prefix
bindir:$prefix/bin
sbindir:   $prefix/sbin/httpd/perl
libexecdir:$prefix/lib/apache
mandir:$prefix/man
sysconfdir:/etc/httpd
datadir:   /home/httpd
iconsdir:  $datadir/icons
htdocsdir: $datadir/html
cgidir:$datadir/cgi-bin
includedir:$prefix/include/apache
localstatedir: /var/httpd
runtimedir:$localstatedir/run
logfiledir:$localstatedir
proxycachedir: $localstatedir


Then I copy mod_auth_mysql.c to apache_1.3.12/src/modules/extra.

in modperl-1.24 I have a small shell file I wrote, myconfig, which says

#!/bin/sh
EAPI_MM=SYSTEM perl Makefile.PL \
APACHE_SRC=../apache_1.3.12/src \
DO_HTTPD=1 \
EVERYTHING=1 \
PERL_TRACE=1 \
PERL_MARK_WHERE=1 \
USE_APACI=1 \
APACI_ARGS='--with-layout=Everett \
--target=httpd-perl \
--disable-module=userdir \
--disable-module=cgi \
--disable-module=imap \
--disable-module=asis \
--disable-module=autoindex \
--disable-module=dir \
--activate-module=src/modules/extra/mod_auth_mysql.c \
--enable-module=auth_mysql'

then I run myconfig (I was getting tired of typing all that in!),
and then I run make.  myconfig runs with no errors and Apache builds 
with no errors, so then I run make test, and I fail some tests.  Here 
are the lines from the summary:

Failed TestTotal Fail  Failed  List of Failed
-
modules/cgi.t  51  20.00%  5
modules/include42  50.00%  2, 4

It also skips the test on modules/module.

That's my current build as it stands currently.  I started with
everything 
but perl a DSO, and then added EAPI_MM=SYSTEM to match my apache+mod_ssl
build.  Next I'm going to try ading cgi support back in.

Again, I appreciate any help you can give me.

Christopher Everett
a DSO module



PATCH: AIX build fix for the apaci style build

2000-08-23 Thread Jens-Uwe Mager

Well, I have only used the apxs DSO style build previously and did not
notice that for linking modperl statically into httpd (apaci style)
there are small problems due to the AIX specifix .exp file business. The
following patch fixes this, in particular it adds the mod_perl.exp file
as an export file while httpd is linked to export the extra symbols from
modperl needed by libapreq and Embperl. It also adds logic to
Apache::src to find the httpd.exp if modperl is not a DSO.

While doing that I noticed that mod_include if built as DSO for PERL_SSI
needs to reference the perl symbols but the build procedure does only
reference the httpd.exp file and not the perl.exp file, so this will not
work yet. I had to use a config like this:

perl Makefile.PL EVERYTHING=1 DO_HTTPD=1 USE_APACI=1 \
APACI_ARGS="--enable-module=most --enable-shared=max --disable-shared=perl 
--disable-shared=include"

I also tested the build procedure using the apxs tool like this:

perl Makefile.PL USE_APXS=1 EVERYTHING=1 WITH_APXS=/usr/local/apache/bin/apxs

this still works but has the problem of the memory leak at server
restart.

-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:  +49 5131 709320
FAX:+49 5131 709325
Internet:   [EMAIL PROTECTED]


Index: apaci/mod_perl.config.sh
===
RCS file: /home/cvspublic/modperl/apaci/mod_perl.config.sh,v
retrieving revision 1.18
diff -u -d -r1.18 mod_perl.config.sh
--- apaci/mod_perl.config.sh2000/03/31 05:16:05 1.18
+++ apaci/mod_perl.config.sh2000/08/23 22:29:50
@@ -147,6 +147,13 @@
 print $ldopts;
 EOT
 perl_libs="`$perl_interp $tmpfile2 $perl_libperl`"
+if test $build_type = OBJ
+then
+   case "$os_version" in
+   aix*)  perl_libs="$perl_libs -bE:\$(SRCDIR)/modules/perl/mod_perl.exp" ;;
+   * );;
+   esac
+fi
 perl_inc="`$perl_interp -MConfig -e 'print "$Config{archlibexp}/CORE"'`"
 perl_privlibexp="`$perl_interp -MConfig -e 'print $Config{privlibexp}'`"
 perl_archlibexp="`$perl_interp -MConfig -e 'print $Config{archlibexp}'`"
Index: lib/Apache/src.pm
===
RCS file: /home/cvspublic/modperl/lib/Apache/src.pm,v
retrieving revision 1.26
diff -u -d -r1.26 src.pm
--- lib/Apache/src.pm   2000/06/05 18:16:33 1.26
+++ lib/Apache/src.pm   2000/08/23 22:29:51
@@ -258,7 +258,12 @@
push @ldflags, "-bI:" . $file;
}
my $httpdexp = $self->apxs("-q" => 'LIBEXECDIR') . "/httpd.exp";
-   push @ldflags, "-bI:$httpdexp" if -e $httpdexp;
+   if (-e $httpdexp) {
+   push @ldflags, "-bI:$httpdexp";
+   } else {
+   $httpdexp = $self->dir . "/support/httpd.exp";
+   push @ldflags, "-bI:$httpdexp" if -e $httpdexp;
+   }
 }
 return join(' ', @ldflags);
 }



make test error (long)

2000-08-23 Thread Christopher Everett

OK,

I know this is a little bit off topic, and I won't resent any flamage 
agreeing with me on that but I can't raise any responses whatsoever in
comp.infosystems.www.servers.unix and [EMAIL PROTECTED] 
is quiet, so I'm bringing my troubles here in the hopes that I can get
at least pointed in the right direction.

I'm declaring myself officially, completely lost.  I'm trying to compile
a new apache+mod_perl+mod_auth_mysql and make test fails 1 test in the
cgi module and 2 tests in the include module.  Well, I turned off 
mod_cgi, and I don't need mod_include here either, so I says to myself
fine, I'll install it anyway.  So when I go to start httpd-perl
I get an error saying:

syntax error on line 28 of /etc/httpd-perl.conf:
API module structure 'env_module' in file 
/usr/local/lib/apache/mod_env.so is garbled - perhaps this is not an
Apache module DSO?
/usr/local/sbin/httpd-perl-ctl start: httpd could not be started.

Aaargh! now I'm dead in the water.  So I pull down fresh sources for
apache, mod perl, and mod_auth_mysql and try it all over again, with 
the same (predictable) results.

The possibilities I see are:

1) my apache+mod_perl shares lib/apache with my front-end 
apache+mod_ssl that I compiled with mm-1.1.3 support, but I 
didn't do that with apache+mod_perl.
2) I changed my ld.so.conf to include /usr/local/lib, 
/usr/local/lib/apache, and /usr/local/lib/mysql, and ran 
ldconfig -v on that, which doesn't make sense since
the apache+mod_ssl works fine and dandy.  Anyway I need 
the /usr/local/lib/mysql at least for mod_auth_mysql to work.
3) I can't share DSO modules between apache+mod_ssl and
apache+mod_perl, mm support or not.

Unfortunately, where I'm at is that I can't parse t/logs/error_log
at all, nor does anything in the test kit jump out at me and say
"OK, now I'm testing this part of the server."

So, I'm trundling off to test possibilities 1 and 3.  In the meantime
if anyone can either tell me I'm completely on the wrong track, or
point towards places, things, or people which would be useful, I'd me
most grateful; this is my development box, and I can't do any 
development until I solve this.

Christopher Everett



Re: Passing a hash to a cgi outside a form?

2000-08-23 Thread Ruben I Safir

Passing a Hash is a CGI proble (and done like all hash passing). 
Mod_perl is not CGI.

Please - if you can. try to send messages as text only without an
attachment.

Ruben

> perl wrote:
> 
> Hi there!
> 
> Sorry for this question which might sound easy to you, but, does
> anyone know :
> How can a CGI pass and receive a hash without a form?
> 
> Please have a look at the following simple scripts :
> 
> This is test.cgi
> ---
> #!/usr/bin/perl
> use CGI;
> 
> $list->{'value1'} = 'apple';
> $list->{'value2'} = 'fruit';
> 
> print "Location: test2.cgi?list=$list \n\n";
> --
> 
> This is test2.cgi
> --
> #!/usr/bin/perl
> 
> use CGI qw (:standard);
> 
> print header;
> 
> $list = param('list');
> 
> foreach (keys %{$list})
> {
> print "KEY IN LIST = ",$_,br;
> }
> --
> 
> Thank you for your help !

-- 
Ruben I Safir

[EMAIL PROTECTED]
[EMAIL PROTECTED]

Perl Notes:
http://www.wynn.com/jewish/perl_course

http://www.brooklynonline.com
Manager of Intranet Development NYU College of Dentistry
Resume:  http://www.wynn.com/jewish/resume.html



CGI.pm reporting undefined subroutine and script mysteriously failing

2000-08-23 Thread Shimon Rura

I've been working on a Perl module, package CARS::Web, which provides
various important functionality for web development for my group.  It
inherits from the CGI module in order to absorb its functionality.  (All
functions I added have a standard prefix and my new object data sits in its
own sub-hash, so I don't think there are conflicts.)  However, when testing
it aggressively under mod_perl, I sometimes get failure with the following
error message:

Undefined subroutine CARS::Web::select

There is indeed no such subroutine; for a CARS::Web object $w, a user calls
$w->select({-name=>'something'}, 'HTML option tags') to generate a  ...  block.  I do "use CGI '-any'" in the script, so the idea
is that after failing to find a 'select' method in CARS::Web or its
superclass (CGI) Perl looks at AUTOLOAD methods.  CARS::Web doesn't have
one, so it goes to CGI.pm's AUTOLOAD method.  Normally this method would
look at the requested method ('select'), say "I don't know any methods like
that", and die with the error message above.  (Detour: The CGI module uses
this technique as an optimization: it compiles methods as they are requested
in order to reduce startup time.)  But since I've used CGI's '-any' pragma,
it is supposed to say "I haven't seen this, but I'll pretend I have and let
it work like any other method."  Normally, this happens fine: it properly
synthesizes a method CARS::Web::select which spits out the proper HTML code.
But sometimes, especially during heavy load (simulated by scripts), it
doesn't work right.  My browser receives the following (this is according to
netscape or IE view source; the headers *are* sent to the browser):

HTTP/1.1 200 OK
Date: Wed, 23 Aug 2000 18:14:13 GMT
Server: Apache/1.3.12 (Unix) mod_perl/1.24
Connection: close
Content-Type: text/html; charset=iso-8859-1



200 OK

OK
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator,
 [EMAIL PROTECTED] and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.
More information about this error may be available
in the server error log.



And the error message "Undefined subroutine CARS::Web::select" is logged in
the error_log.  This message is generated inside of CGI.pm's AUTOLOAD
subroutine (It doesn't print a line number but I've looked at the code and
that's the only place such a message is formatted).

The headers are present regardless of the setting of PerlSendHeaders On or
Off.

I can't figure out why this is happening: I am using only scripts and
libraries that I wrote in compliance with all the mod_perl documentation.
Furthermore, this error only shows up sometimes: I am not sure whether it
simply sticks around in an httpd child (this would be *very* bad) or if it's
just intermittent anywhere.  Has anyone had a similar error message using
CGI '-any' or when inheriting from CGI?  Any mod_perl or CGI.pm wizards care
to propose a hypothesis for why this happens?  I need my library to be as
reliable as possible (it will be used heavily) so any suggestions are highly
appreciated.

Thanks,
Shimon Rura




Re: anon CVS of modperl hangs?

2000-08-23 Thread Stas Bekman

On Wed, 23 Aug 2000, Jens-Uwe Mager wrote:

> I am trying to do an anon cvs update of modperl and it appears to hang
> without doing anything. I can cvs upd other projects. Could anyone try
> that and look if it works?

It's located on the same machine with other apache projects, the machine
(locus) is overloaded as usual. I see the same behavior here. Should be
resolved soon.


_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org





RE: anon CVS of modperl hangs?

2000-08-23 Thread Geoffrey Young

doesn't work for me...

cvsup seems to be up, though

--Geoff

> -Original Message-
> From: Jens-Uwe Mager [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 23, 2000 2:54 PM
> To: [EMAIL PROTECTED]
> Subject: anon CVS of modperl hangs?
> 
> 
> I am trying to do an anon cvs update of modperl and it appears to hang
> without doing anything. I can cvs upd other projects. Could anyone try
> that and look if it works?
> -- 
> Jens-Uwe Mager
> 
> HELIOS Software GmbH
> Steinriede 3
> 30827 Garbsen
> Germany
> 
> Phone:+49 5131 709320
> FAX:  +49 5131 709325
> Internet: [EMAIL PROTECTED]
> 



Re: executing a cgi from within a handler (templating redux)

2000-08-23 Thread Matt Sergeant

On Wed, 23 Aug 2000, Todd Finney wrote:

> Managing the site in a different way would be pretty great, 
> but we've been asked to do something fairly complicated 
> (this borders thingy) on very short time.  We were looking 
> for a way to do only templating, and leave (essentially) 
> everything else on the site alone.   There's interest in 
> moving to a different system at some point in the future, 
> but we just can't get it done now.

AxKit makes site development really quick, but only if you understand "The
XML Way"... So I totally see where you're coming from.

> >I also think Mason can do what you're after.
> 
> Almost, but we still have a couple of concerns about 
> it.  First, it would mean that we'd have to update all the 
> cgis to not use CGI.pm for form argument handling.

I doubt thats true - CGI.pm just gets its input from the querystring or
STDIN, so it should be able to intercept that in time, I think.

>  Second, 
> we need to be able to do per-user templates, which I don't 
> believe it can do (can AxKit do that?).

Well I'm not sure exactly *how* per-user you want it. For example is that
1000 users and 1000 templates? But yes, it can certainly do custom
templates on a per-request basis. Thats a very basic requirement. Just use
named templates and a StyleChooser module of your making.

-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




anon CVS of modperl hangs?

2000-08-23 Thread Jens-Uwe Mager

I am trying to do an anon cvs update of modperl and it appears to hang
without doing anything. I can cvs upd other projects. Could anyone try
that and look if it works?
-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:  +49 5131 709320
FAX:+49 5131 709325
Internet:   [EMAIL PROTECTED]



Re: VB parser

2000-08-23 Thread Billy Donahue

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, 23 Aug 2000, Jerrad Pierce wrote:

> Date: Wed, 23 Aug 2000 14:05:19 -0400
> From: Jerrad Pierce <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: VB parser
> 
> So what happened to the VB parser? Is it going forward?

There was just a week of UserFriendly about this...
http://ars.userfriendly.org/cartoons/?id=2731&mode=classic
 

- --
"The Funk, the whole Funk, and nothing but the Funk."
Billy Donahue 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: pgpenvelope 2.9.0 - http://pgpenvelope.sourceforge.net/

iD8DBQE5pBz3+2VvpwIZdF0RAod+AKCHEUi+q5EJEra4LexKvHhwzvlY+ACglhBv
OxCDprTzcwcKTHFauixjVT0=
=PVLG
-END PGP SIGNATURE-




VB parser

2000-08-23 Thread Jerrad Pierce

So what happened to the VB parser? Is it going forward?



RE: Producing an error page

2000-08-23 Thread Perrin Harkins

On Tue, 22 Aug 2000, Howard Jones wrote:

> Something that may be worthwhile as a starting point for you is CGI::Debug

There is an Apache::Debug in the standard distribution.  If you turn on
the debugging flag in Apache::Registry, it looks like it will send the
errors to the client using this module.

- Perrin




Re: executing a cgi from within a handler (templating redux)

2000-08-23 Thread Perrin Harkins

On Wed, 23 Aug 2000, Todd Finney wrote:
> We were looking for a way to do only templating, and leave
> (essentially)  everything else on the site alone.

For that, Template Toolkit, HTML::Template, or CGI::FastTemplate are
probably your best options.

> Almost, but we still have a couple of concerns about 
> it.  First, it would mean that we'd have to update all the 
> cgis to not use CGI.pm for form argument handling.

You mean for HTML generation and "sticky" forms?  You can still use CGI.pm
for that with Template Toolkit and I think you can with Mason as
well.  Take a look at the mail archives.

> Second, we need to be able to do per-user templates, which I don't
> believe it can do (can AxKit do that?).

You can modify the template path at run time with any of these, which
should do the trick.

- Perrin




RE: env in background process

2000-08-23 Thread Sheth, Niraj

Didn't get any reply yet on this, so I think i am doing something very
stupid ...

Can anyone try it and tell me if gets the same result?

Thanks,
Niraj

> -Original Message-
> From: Niraj Sheth [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 15, 2000 11:03 AM
> To: [EMAIL PROTECTED]
> Subject: RE: env in background process
> 
> 
> Follow up on this.
> 
> script1.pl(set FOO1 env)
> ===
> #!/usr/local/bin/perl
> 
> print "Content-type: text/html\n\n";
> print "PID = $$\n";
> print "SCRIPT1 with FOO1\n";
> 
> #local %ENV = %ENV;
> 
> $ENV{FOO1} = "foo1";
> print map { "$_ = $ENV{$_}\n"; } sort keys %ENV;
> 
> $command = "dump_env";
> print `$command &`; # put it in the background
> 
> -- end
> 
> script2.pl(set FOO2 env)
> ===
> #!/usr/local/bin/perl
> 
> print "Content-type: text/html\n\n";
> print "PID = $$\n";
> print "SCRIPT1 with FOO2\n";
> 
> #local %ENV = %ENV;
> 
> $ENV{FOO2} = "foo2";
> print map { "$_ = $ENV{$_}\n"; } sort keys %ENV;
> 
> $command = "dump_env";
> print `$command &`; # put it in the background
> 
> -- end
> 
> dump_env
> ===
> #!/usr/local/bin/perl
> 
> print "$0 @ARGV\n";
> 
> print map { "$0 $_ = $ENV{$_}\n"; } sort keys %ENV;
> 
> --end
> 
> running "httpd -X" i will get FOO1 and FOO2 both from the print
> statement of dum_env.
> while script1.pl is ONLY printing FOO1 which is correct as well as
> script2.pl is ONLY printing FOO2 which is also correct.
> 
> so why dump_env is getting both?
> If I either uncomment "local %ENV = %ENV;" in script or put 
> "%ENV = ();"
> in PerlCleanupHandler then dump_env is working fine.
> I tried both Apache::PerlRun and Apache::Registry which same result.
> 
> I would appreciate any help.
> 
> -Niraj
> 
> > -Original Message-
> > From: Niraj Sheth [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, August 14, 2000 12:10 PM
> > To: [EMAIL PROTECTED]
> > Subject: env in background process
> >
> >
> > Hi,
> >
> > I am having very strange problem with environment variables.
> >
> > >From Apache::PerlRun script(cgi) I am setting env and firing
> > background
> > process ..
> > system("$command &") (or print `$command &`;)
> >
> > now looks like environment variable being persistence b/w different
> > requests ONLY in background process. so it's looks to me 
> that mod_perl
> 
> > is setting proper "Perl Level" env but failing to reset env
> > at "c level"
> > or "process level". I know it's sounds very weird.
> > /perl-status?env is printing correctly but my background process
> > ($command) is printing few extra env, which i set it in 
> different cgi
> > script.
> >
> > e.g. "script1.pl" is setting $ENV{foo1} = "foo1" and firing print
> > `command1 &`;
> > and "script2.pl" is setting $ENV{foo2} = "foo2" and firing print
> > `command2 &`;
> >
> > after few hits both env(foo1 and foo2) are visible to both 
> background
> > processes.
> > while /perl-status?env is displaying correctly.
> > Here command1 and command2(perl scripts) are just printing env
> >
> > Apache/1.3.9 (Unix) mod_perl/1.21
> > Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
> >   Platform:
> > osname=solaris, osvers=2.6, archname=sun4-solaris
> > uname='sunos nlsun268 5.6 generic_105181-14 sun4u sparc
> > sunw,ultra-4
> > '
> > hint=recommended, useposix=true, d_sigaction=define
> > usethreads=undef useperlio=undef d_sfio=undef
> >   Compiler:
> > cc='gcc', optimize='-O', gccversion=2.8.1
> > cppflags='-I/usr/local/include'
> > ccflags ='-I/usr/local/include'
> > stdchar='unsigned char', d_stdstdio=define, usevfork=false
> > intsize=4, longsize=4, ptrsize=4, doublesize=8
> > d_longlong=define, longlongsize=8, d_longdbl=define,
> > longdblsize=16
> > alignbytes=8, usemymalloc=y, prototype=define
> >   Linker and Libraries:
> > ld='gcc', ldflags =' -L/usr/local/lib'
> > libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
> > libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
> > libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
> >   Dynamic Linking:
> > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
> > cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
> >
> >
> > Any comments?
> >
> > Thanks,
> > Niraj
> >
> 



Re: executing a cgi from within a handler (templating redux)

2000-08-23 Thread Alex Menendez


H, the do does seem a little inefficient. I solved this problem in the
past by intiating a subrequest and changing the stack handler to
cgi-script right before running the cgi. something like this:

$subr = $r->lookup_uri($uri);
if($r->filename =~ /\.(cgi|pl)$)/o) {
$subr->handler('cgi-script');
}
$subr->run();

you might get into some trouble with headers if your cgi's return
http headers other than just Content-type like Location. If they don't go 
ahead and add $r->send_http_header right before the run command. If they
do send other headers, you will need a patch for Apache.xs in the mod_perl
src. I have it and can give it to you if you are interested.

-amen

On Wed, 23 Aug 2000, Todd Finney wrote:

> Hi,
> 
> I'm building a simple templating system.   The major 
> requirement of the system is that allow custom dynamic 
> headers, footers, and toolbars based upon the identity of 
> the user.
> 
> The system so far works like this:
>  - a user enters the site and logs in.  The names 
> of the user's default
>  template, header, footer, and toolbar are placed 
> into a cookie
>  (via Apache::Session).
>  - when the user requests a page, my handler 
> intercepts that request, and
>  looks at the user's cookie.  Based upon the 
> information in it, it grabs the
>  appropriate template and components from the 
> filesystem along with the
>  requested page, rolls them together, and serves 
> the result.
> 
> A sample template file looks like this:
> 
> 
> Standard Template
> 
>  border="0">
> 
> 
>   
>   
> 
> 
> 
> 
> Component files, such as the header, footer and toolbar, 
> are by convention self-contained html tables, ala
> 
> # file components/tool/standard
> 
> 
> Link 
> One
> Link 
> Two
> Link 
> Three
> Link 
> Four
> Link 
> Five
>  href="/wrapped/cgi-bin/test.pl">CGI
> 
> I have a working version of this handler, but I think that 
> there's a better way to do it, specifically the part that 
> manages the content return part of the request.   Static 
> files are simple enough; I open the file and print it to 
> STDOUT.  Scripts, however, need to be handled 
> differently.   The way I'm doing it now works, but it 
> strikes me as inefficient.
> 
> package My::Wrapper;
> 
> use strict;
> use Apache::Constants qw(:common DONE);
> use Apache::Log ();
> 
> sub handler {
>  my ( $r ) = shift;
>  my ( $log ) = $r->log;
>  $log->info("Wrapper: Inside Wrapper.");
>  my ( $template_directory ) = "/www/html/templates/";
>  my ( $components_directory ) = 
> '/www/html/components/';
>  #
>  # these next four variables will come from the cookie, 
> they are
>  # set manually for now.
>  #
>  my ( $template ) = $template_directory.'standard';
>  my ( $header ) = 
> $components_directory.'head/'.'standard';
>  my ( $toolbar ) = 
> $components_directory.'tool/'.'standard';
>  my ( $footer ) = 
> $components_directory.'feet/'.'standard';
>  $r->send_http_header;
>  if ( -e $template ) {
>  open( TEMPLATE, "$template" ) or die "Failed to 
> open template $template: $!";
>  while () {
>  if ( $_ =~ 
> /(.*)<\!--\sWrapper:(\w+)\s-->(.*)/o ) {
>  my ( $before ) = $1;
>  my ( $component ) = $2;
>  my ( $after ) = $3;
>  my ( $name );
>  $name = $header if $component eq 'header';
>  $name = $toolbar if $component eq 
> 'toolbar';
>  $name = $footer if $component eq 'footer';
>  print $before; &print_component($name); 
> print $after;
>  } elsif ( $_ =~ /(.*)<\!--\sContent\s-->(.*)/o 
> ) {
>  my ( $before ) = $1;
>  my ( $after ) = $2;
>  my ( $file ) = $r->filename;
>  print $before;
>  if ( -e $file ) {
>  if ( $file =~ /(?:cgi|pl)$/ ) {
>  $log->info("Wrapper: cgi script 
> requested.");
>  do $file;
>  } else {
>  $log->info("Wrapper: static file 
> requested.");
>  open(CONTENT, "$file" ) or die 
> "Failed to open content file $file: $!";
>  while () {
>  print $_;
>  }
>  close(CONTENT);
>  }
>  }
>  print $after;
>  } else {
>  print $_;
>  }
>  }
>  close( TEMPLATE );
>  }
>  $log->info("Wrapper: Exiting Wrapper.");
>  return DONE;
> }
> 
> sub print_component {
>  my ( $component ) = shift;
>  if ( -e $component ) {
>  open(IN, "$component" ) or die "Failed to open 
> component $component: $!";
>  while () {
>  print $_;
>  }
>  close(IN);
>  

Re: executing a cgi from within a handler (templating redux)

2000-08-23 Thread Todd Finney

At 12:03 PM 8/23/00, Matt Sergeant wrote:
>On Wed, 23 Aug 2000, Todd Finney wrote:
> > We looked at Template::Toolkit and also at Axkit, but 
> both
> > seemed to be much larger hammers than we needed.   It 
> also
> > (and I could be incorrect here) did not appear to have 
> the
> > capability to select the included component dynamically 
>
> > based upon information provided at request time, and 
> pass
> > that information into the component.
>
>AxKit does, but I accept the thing about it being a big 
>hammer for a
>potentially small job. You should use something like AxKit 
>when you're
>looking to build a site that will change at some point, 
>and you didn't
>like managing your site "the old way".

Thanks, Matt.

Managing the site in a different way would be pretty great, 
but we've been asked to do something fairly complicated 
(this borders thingy) on very short time.  We were looking 
for a way to do only templating, and leave (essentially) 
everything else on the site alone.   There's interest in 
moving to a different system at some point in the future, 
but we just can't get it done now.

>I also think Mason can do what you're after.

Almost, but we still have a couple of concerns about 
it.  First, it would mean that we'd have to update all the 
cgis to not use CGI.pm for form argument handling.  Second, 
we need to be able to do per-user templates, which I don't 
believe it can do (can AxKit do that?).

I've never used Mason, this is just what I got from the FAQ 
and the doc.   If there's a way around this, we'd take 
another look at it.

Todd
  




Re: Producing an error page

2000-08-23 Thread Nathan Vonnahme


> -Original Message-
> From: Jay Strauss [mailto:[EMAIL PROTECTED]]
>
> I've tried the suggestions so far:
>
> cgi::carp
> http://perl.apache.org/guide/snippets.html#Redirecting_Errors_to_t
> he_Client
> BEGIN { print "Content-Type: text/plain\n\n"; *STDERR = *STDOUT }

Jay,

Below is a module I wrote for doing what you want.  It'll need some name
changing, but the POD at the bottom should explain mostly how to use it.  
One feature is that you can give it a list of "developer" IP addresses
that should see the Perl errors, while other people get a nice bug report
form.  It even works with mod_perl, but beware:  once you use it on one
Registry CGI, all your mod_perl CGIs handle their errors this way.

I don't think I've done everything the most proper or best way but it has
worked in a production environment for a year or so.  I'd welcome comments
or encouragement to put it in CPAN.

Cheers,
nathan
~
Nathan Vonnahme [EMAIL PROTECTED]
http://enteuxis.org/nathan  http://thethirdsector.com


# $Id: CGI_errors.pm,v 1.3 1998/08/26 01:53:55 nathanv Exp $

#  Enteuxis::CGI_errors

# improve CGI error-reporting!  Give an intelligible message to someone on a 
development machine, 
#  or a bug report form to a user and an email report to $alert_email.
#
#  see the pod documentation at the bottom for more...
#
# Copyright 1998 Internet Alaska, Inc.
# 
# written by [EMAIL PROTECTED]


package Enteuxis::CGI_errors;

use vars qw(@ISA @EXPORT $VERSION);
require Exporter;
@ISA = Exporter;
@EXPORT = qw(setup_CGI_errors);

$VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);


use strict;
use CGI::Carp;

my $mailprog = '/usr/lib/sendmail';
my $FORMMAIL_URL = 'http://www.alaska.net/cgi-bin/FormMail.pl';
my $default_email = 'nathan\@enteuxis.org';

my @dev_machines = (
'208.151.124.132',
'inferno.infoinsights.com',
);

my @warnings = ();

sub setup_CGI_errors {
$| = 1;
my $alert_email = shift || $default_email;

$main::SIG{'__WARN__'} = sub {
push @Enteuxis::CGI_errors::warnings, @_ ;
};

$main::SIG{'__DIE__'} = sub {
my $mesg;
# set $header to a valid HTTP header
my $header = "Content-type: text/html\n\n";

if ( ! $ENV{REMOTE_HOST} ||
 (join " ", @dev_machines) =~ /\b$ENV{REMOTE_HOST}\b/ ) {
$mesg = "SCRIPT ERROR\n";

$mesg .= "WARNINGS:\n\n";
foreach ( @Enteuxis::CGI_errors::warnings ) { $mesg .= 
"$_\n"; }
$mesg .= "\n";
$mesg .= "DIE MESSAGE: @_";

my($package,$file,$line) = caller();
$mesg .= "Died in $package at $file line $line.\n";

print STDOUT $header . $mesg;
exit;
}
else {
my $url = 
"$ENV{SERVER_URL}$ENV{SCRIPT_NAME}$ENV{PATH_INFO}?$ENV{QUERY_STRING}";
$mesg = qq[

Script Error


SCRIPT ERROR

Congratulations!  You've found a bug!  Our staff have been notified and the problem 
should be fixed soon.\n
We'd like it if you can also send us a short description of what you were trying to 
do:




Your name (optional)
Your email address (optional)
What were you trying to do? 



\n\n];
open ERRMAIL, "|$mailprog -t" or die "couldn't open mail pipe- 
$!";
print ERRMAIL "To: $alert_email\n", 
  "From: the.web.server\n", 
  "Subject: $ENV{SCRIPT_NAME} is 
broken!\n\n";

print ERRMAIL "The CGI at $url died!\n\n";
print ERRMAIL "WARNINGS:\n", join( "\n",
@Enteuxis::CGI_errors::warnings ), "\n\n";
print ERRMAIL "DIE MESSAGE:\n@_\n\n";
print ERRMAIL "ENVIRONMENT VARIABLES:\n";
print ERRMAIL "Here are the contents of ENV when this attempt 
to run the script was made:\n";
foreach (keys %ENV) {  
print ERRMAIL sprintf("%-32s", $_), " = $ENV{$_}\n";  }
close ERRMAIL;

print "$header\n$mesg\n";
exit;
}
};
}



1;
__END__

# Below is the Plain Old Documentation. 

=head1 NAME

Enteuxis::CGI_errors - Perl extension to improve CGI error-reporting!

Give an intelligible message to someone on a development machine, or a bug
report form to a user and an email report to the script maintainer.

=head1 SYNOPSIS

BEGIN {
use Enteuxis::CGI_errors;
setup_CGI_errors ('natha

Re: executing a cgi from within a handler (templating redux)

2000-08-23 Thread Matt Sergeant

On Wed, 23 Aug 2000, Todd Finney wrote:

> Thanks, Ken.
> 
> We looked at Template::Toolkit and also at Axkit, but both 
> seemed to be much larger hammers than we needed.   It also 
> (and I could be incorrect here) did not appear to have the 
> capability to select the included component dynamically 
> based upon information provided at request time, and pass 
> that information into the component.

AxKit does, but I accept the thing about it being a big hammer for a
potentially small job. You should use something like AxKit when you're
looking to build a site that will change at some point, and you didn't
like managing your site "the old way".

I also think Mason can do what you're after.

-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




Updates to www.modperl.com site

2000-08-23 Thread Lincoln Stein

Hi,

I am very gradually making changes to the modperl book site.  My plan
over the next few weeks is to bring more of the examples online.  Suggestions
for priorities are very much appreciated.

As of this morning, I have added an online demo of my Apache::MP3 module,
which does nice directory listings of MP3 files and allows you to select
and stream them.  I also cleaned up the look of the page a bit, but it
is still a bit primitive.

Lincoln



Re: executing a cgi from within a handler (templating redux)

2000-08-23 Thread Todd Finney

Thanks, Ken.

We looked at Template::Toolkit and also at Axkit, but both 
seemed to be much larger hammers than we needed.   It also 
(and I could be incorrect here) did not appear to have the 
capability to select the included component dynamically 
based upon information provided at request time, and pass 
that information into the component.

There was also a concern with implementation time.  The 
site in question is already operational, with a few hundred 
static pages and a fair number of CGIs.   Retrofitting all 
of the pages to work with the toolkit seemed to be a 
daunting task.  That's not even including the time involved 
in teaching your web developers how to use the new system.

My plan seems simpler - create the default header, footer, 
and toolbar files, write a script to strip out that 
information from the existing site files, turn on the 
handler, and go.   Don't let the templating system handle 
anything except templating, and leave all the logic up to 
the component and content files which could be html, cgi, 
anything.

Todd





At 10:41 AM 8/23/00, Ken Y. Clark wrote:
>is there a particular reason why you've not chosen to use 
>one of the very
>excellent existing templating systems?  i've used 
>HTML::Template for many
>things;  it's very lightweight and incredibly easy, and 
>i'm pretty sure it
>would solve your problems.  lately, i've been getting into
>Template::Toolkit, and i find it to be *very* powerful, 
>easy, and much
>more flexible than HTML::Template.  i'd really recommend 
>you exhaust all
>your options with one of the currently available template 
>kits on CPAN
>before you roll your own.
>
>ky




Re: Acmemail vs WING (was Re: mod_perl-friendly webmail solutions?)

2000-08-23 Thread martin langhoff

entropic,

is WING something I can deploy and configure/customize (like most
webmail solutions) or should code the interface to get it to work?

does it support imap folders and address books? 

martin

[EMAIL PROTECTED] wrote:
 
> Wing scales well.  Its the 'imap' server where you will have issues. I use
> wing with imap-uw and about 50 'trusted' users.



New module cadidate Apache::AddHostPath

2000-08-23 Thread Robert Jenks

I have written a new PerlTransHandler module which I currently calling
Apache::AddHostPath.  It was written to solve a problem I am having in an
application I am writing, however if others think it might be usefull and
there isn't already something out there that does it, I'd be more than happy
to add it to CPAN.

The problem I was trying to solve was that I have 11+ domains, (each of
which may have additional sub-domains besides "www") that I wish to host
from one single apache server and without using Virtual Hosts.  The reason I
don't want to use Virtual Hosts is that I want to be able to inherit things
like images, cgi scripts, stylesheets, javascript, etc.. between domains and
sub-domains without having to do weird symbolic links, or even having to
mess with httpd.conf.  I also want to be able to add domains and sub-domains
without changing the config.  Point the domain and play. :-)

For example not all of the domains are in the same top level domain and I
may want to share the same style sheets between all of my .com domains but
use a different one for .org domains.  Additionally any of the specific .org
domains (or Sub-Domains) could override this stylesheet with their own.

Essentially the module implements Apache's URI translation phase by
attempting to use some or all of the URL hostname and port number as the
base of the URI.

For example:  If a user requested:

http://www.cvsroot.org/images/logo.gif

My module would attempt all of the following combinations, in this order,
until if found the best match (best match being defined as the first one to
return true to (-f $filename or -d $filename)):

$doc_root/org/cvsroot/www/80/images/logo.gif
$doc_root/org/cvsroot/www/images/logo.gif
$doc_root/org/cvsroot/images/logo.gif
$doc_root/org/images/logo.gif
$doc_root/images/logo.gif
$doc_root/org/cvsroot/www/80/images
$doc_root/org/cvsroot/www/images
$doc_root/org/cvsroot/images
$doc_root/org/images
$doc_root/images
$doc_root/org/cvsroot/www/80/
$doc_root/org/cvsroot/www/
$doc_root/org/cvsroot/
$doc_root/org/
$doc_root/
(Failing this it will return DECLINED)

When it finds a match it will tack the portions of the original URI which
had been removed for testing back onto the full path (Thereby preserving any
extra path info, virtual documents, etc...) and sets the $r->filename()

For example, in the above example, if it had selected '$doc_root/org/images'
as the first match, then it would set the $r->filename to
'$doc_root/org/images/logo.gif' even though I already found out it didn't
exist. It does this because of things like extra path info on cgi scripts
and virtual documents returned by content handlers.  Thus relying on the
content handler to do any real validation of the URI & filename.

I have several questions for the mod_perl community:

1) Would this be usefull to the community? (assuming there isn't already a
mod to do this)
2) What about the name?
3) Should I be changing $r->uri() instead, thus allowing additional
TransHandlers? Or maybe setting both?
4) Any ideas for improvement?

The module is already written and seems to work ok.  I still need to write
docs and packaging if I submit to CPAN, but the module itself is only about
25 lines of code.

Thanks in advance,
-Robert Jenks
[EMAIL PROTECTED]




A precision about "All RAM Consumed" in the manual

2000-08-23 Thread Benoit Caron

Hello.

I've read the recommendation in

http://perl.apache.org/guide/control.html#All_RAM_Consumed

to put a sub like that 

 sub UNIVERSAL::AUTOLOAD {
   my $class = shift;
   warn "$class can't \$UNIVERSAL::AUTOLOAD!\n";
 }

to trap the memory leaking that can occur if a sub is undefined. But
where should I put this sub? In all my mod-perl module? In my startup.pl
file?

And, since I'm there, anyone can recommend me a way to hunt the memory
leak of my modules? I've inherit an already well developped site that
leak a lot and I'd like to trap those memory leaking... I'm on Solaris,
if that can help...


-- 
Benoit Caron
Programmeur / Chargé de projet
Netgraphe - La Toile du Québec Communications
[EMAIL PROTECTED]
- - - - - - - - - - - - - - - - - - - - - - - -
Hi, I'm a signature virus. plz set me as your signature and help me
spread
:)



Re: executing a cgi from within a handler (templating redux)

2000-08-23 Thread Ken Y. Clark

On Wed, 23 Aug 2000, Todd Finney wrote:

> Hi,
> 
> I'm building a simple templating system.   The major 
> requirement of the system is that allow custom dynamic 
> headers, footers, and toolbars based upon the identity of 
> the user.
> 

is there a particular reason why you've not chosen to use one of the very
excellent existing templating systems?  i've used HTML::Template for many
things;  it's very lightweight and incredibly easy, and i'm pretty sure it
would solve your problems.  lately, i've been getting into
Template::Toolkit, and i find it to be *very* powerful, easy, and much
more flexible than HTML::Template.  i'd really recommend you exhaust all
your options with one of the currently available template kits on CPAN
before you roll your own.

ky




Re: Acmemail vs WING (was Re: mod_perl-friendly webmail solutions?)

2000-08-23 Thread brian moseley

On Wed, 23 Aug 2000 [EMAIL PROTECTED] wrote:

> Wing scales well.  Its the 'imap' server where you will
> have issues. I use wing with imap-uw and about 50
> 'trusted' users.

what issues will you have with the imap server?

> I'm looking into a 'ldap' email alternative. But haven't
> learned the reality there.  If I find 'ldap email' is
> sane, I'm going to hack Wing's 'maild' for my needs.

*cough*




Re: Acmemail vs WING (was Re: mod_perl-friendly webmail solutions?)

2000-08-23 Thread entropic

On Wed, Aug 23, 2000 at 02:51:22PM +0100, David Hodgkinson wrote:
  > 
  > Leon!
  > 
  > > Development will start again as soon as yapc::Europe is over and
  > > people get back from holiday, honest. Scalability will really only
  > > happen when I can get some beefy servers to test it on.
  > 
  > What are the scalability issues? I'm looking at the possiblity of
  > doing this for some hundreds of thousands of users. If I could staple
  > WING onto the Template Toolkit AND it scaled, I'd be in hog
  > heaven. What templater are you using?

Wing scales well.  Its the 'imap' server where you will have issues. I use
wing with imap-uw and about 50 'trusted' users.  

I'm looking into a 'ldap' email alternative. But haven't learned the reality 
there.  If I find 'ldap email' is sane, I'm going to hack Wing's 'maild' for my
needs.

good luck, Wendell




executing a cgi from within a handler (templating redux)

2000-08-23 Thread Todd Finney

Hi,

I'm building a simple templating system.   The major 
requirement of the system is that allow custom dynamic 
headers, footers, and toolbars based upon the identity of 
the user.

The system so far works like this:
 - a user enters the site and logs in.  The names 
of the user's default
 template, header, footer, and toolbar are placed 
into a cookie
 (via Apache::Session).
 - when the user requests a page, my handler 
intercepts that request, and
 looks at the user's cookie.  Based upon the 
information in it, it grabs the
 appropriate template and components from the 
filesystem along with the
 requested page, rolls them together, and serves 
the result.

A sample template file looks like this:


Standard Template




  
  




Component files, such as the header, footer and toolbar, 
are by convention self-contained html tables, ala

# file components/tool/standard


Link 
One
Link 
Two
Link 
Three
Link 
Four
Link 
Five
CGI

I have a working version of this handler, but I think that 
there's a better way to do it, specifically the part that 
manages the content return part of the request.   Static 
files are simple enough; I open the file and print it to 
STDOUT.  Scripts, however, need to be handled 
differently.   The way I'm doing it now works, but it 
strikes me as inefficient.

package My::Wrapper;

use strict;
use Apache::Constants qw(:common DONE);
use Apache::Log ();

sub handler {
 my ( $r ) = shift;
 my ( $log ) = $r->log;
 $log->info("Wrapper: Inside Wrapper.");
 my ( $template_directory ) = "/www/html/templates/";
 my ( $components_directory ) = 
'/www/html/components/';
 #
 # these next four variables will come from the cookie, 
they are
 # set manually for now.
 #
 my ( $template ) = $template_directory.'standard';
 my ( $header ) = 
$components_directory.'head/'.'standard';
 my ( $toolbar ) = 
$components_directory.'tool/'.'standard';
 my ( $footer ) = 
$components_directory.'feet/'.'standard';
 $r->send_http_header;
 if ( -e $template ) {
 open( TEMPLATE, "$template" ) or die "Failed to 
open template $template: $!";
 while () {
 if ( $_ =~ 
/(.*)<\!--\sWrapper:(\w+)\s-->(.*)/o ) {
 my ( $before ) = $1;
 my ( $component ) = $2;
 my ( $after ) = $3;
 my ( $name );
 $name = $header if $component eq 'header';
 $name = $toolbar if $component eq 
'toolbar';
 $name = $footer if $component eq 'footer';
 print $before; &print_component($name); 
print $after;
 } elsif ( $_ =~ /(.*)<\!--\sContent\s-->(.*)/o 
) {
 my ( $before ) = $1;
 my ( $after ) = $2;
 my ( $file ) = $r->filename;
 print $before;
 if ( -e $file ) {
 if ( $file =~ /(?:cgi|pl)$/ ) {
 $log->info("Wrapper: cgi script 
requested.");
 do $file;
 } else {
 $log->info("Wrapper: static file 
requested.");
 open(CONTENT, "$file" ) or die 
"Failed to open content file $file: $!";
 while () {
 print $_;
 }
 close(CONTENT);
 }
 }
 print $after;
 } else {
 print $_;
 }
 }
 close( TEMPLATE );
 }
 $log->info("Wrapper: Exiting Wrapper.");
 return DONE;
}

sub print_component {
 my ( $component ) = shift;
 if ( -e $component ) {
 open(IN, "$component" ) or die "Failed to open 
component $component: $!";
 while () {
 print $_;
 }
 close(IN);
 return 1;
 } else {
 print "Failed to open component $component.";
 return 0;
 }
}
1;
__END__

I have experimented with various ways of handling this, 
such as printing a redirect, but this is the only way I 
could get it to work.  I suspect that there is a better way 
to do it.   I'd rather not `` the script, because of 
efficiency worries and the desire to maintain some process 
environment variables used in our authentication systems.

Thanks a bunch,
Todd






Re: Acmemail vs WING (was Re: mod_perl-friendly webmail solutions?)

2000-08-23 Thread David Hodgkinson


Leon!

> Development will start again as soon as yapc::Europe is over and
> people get back from holiday, honest. Scalability will really only
> happen when I can get some beefy servers to test it on.

What are the scalability issues? I'm looking at the possiblity of
doing this for some hundreds of thousands of users. If I could staple
WING onto the Template Toolkit AND it scaled, I'd be in hog
heaven. What templater are you using?

Cheers,

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -



Re: Acmemail vs WING (was Re: mod_perl-friendly webmail solutions?)

2000-08-23 Thread Leon Brocard

martin langhoff sent the following bits through the ether:

> Acmemail is nicely documented, and seems 'ready to go' (tempting!),
> although I fear it may not be as configurable as I want. Do you know
> anything about it? 

As the main developer of acmemail, I'd actually go for WING - acmemail
is getting there, but recently development has slowed quite a lot. We
have lots of great plans but not really enough time to implement
anything. It currently scales fairly badly too. OTOH the documentation
is very good, and, of course, it's very pretty ;-)

It looked like we were getting critical mass with the number of people
interested in helping development, but no-one has actually contributed
any code recently. It *was* going to make a good case on how open
source development can succeed :-(

Development will start again as soon as yapc::Europe is over and
people get back from holiday, honest. Scalability will really only
happen when I can get some beefy servers to test it on.

btw you could have asked this on the acmemail and WING lists,
surely?

Leon
-- 
Leon Brocard.http://www.astray.com/
yapc::Europe - September 22-24 London - http://yapc.org/Europe/

... Error 404: .signature generator ran out of tuits



Acmemail vs WING (was Re: mod_perl-friendly webmail solutions?)

2000-08-23 Thread martin langhoff

I found the one that Luis suggested, (acmemail) and a few more,
including WING. These 2 are the only ones programmed to take advantage
of mod_perl. I fear the other ones are not mod_perl aware, so the may
not be safe/efficient under mod_perl, so my choices are mainly between
these two. 

Acmemail is nicely documented, and seems 'ready to go' (tempting!),
although I fear it may not be as configurable as I want. Do you know
anything about it? 

WING (http://users.ox.ac.uk/~mbeattie/wing) on the other hand, seems to
offer raw power, but all it offers is a bare webpage without much actual
implementation details. 

please don't think I was bought by the eyecandy in acmemail page
(http://www.astray.com/acmemail), but I need a working solution in a
reasonable timeframe. Acmemail seems to need some tweaking to make it
work. WING, well, either I didn't understand well or needs me to study
the man pages of its modules and design and code an implementation.



Re: Apache::Perfmon 0.011

2000-08-23 Thread Stas Bekman

On Wed, 23 Aug 2000, Ask Bjoern Hansen wrote:

> On Tue, 22 Aug 2000, Stas Bekman wrote:
> 
> [...]
> > Sorry, it's in contrib, not the book:
> > http://perl.apache.org/dist/contrib/Timeit.pm
> 
> And I have an improved version which I for some reason never
> uploaded to CPAN. I guess I didn't get everything I wanted to work
> to work. :) Next time I need it I'll probably finish it and upload
> it. (it was one of the few remaining useful bits of contrib).

So may be it would be a cool idea for you Ask and Lupe to put your code
together and have one module instead two doing a very similar thing. Just
an attempt to keep the available modules choice non-ambiguous of course,
feel free to do whatever you feel is right of course.


_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org





Re: Apache::Perfmon 0.011

2000-08-23 Thread Ask Bjoern Hansen

On Tue, 22 Aug 2000, Stas Bekman wrote:

[...]
> Sorry, it's in contrib, not the book:
> http://perl.apache.org/dist/contrib/Timeit.pm

And I have an improved version which I for some reason never
uploaded to CPAN. I guess I didn't get everything I wanted to work
to work. :) Next time I need it I'll probably finish it and upload
it. (it was one of the few remaining useful bits of contrib).
 


 - ask

-- 
ask bjoern hansen - 
more than 70M impressions per day,