Re: PerlWarn On being ignored on win32

2000-10-10 Thread Randy Kobes

On Mon, 9 Oct 2000 [EMAIL PROTECTED] wrote:

 Hi,
 I have problems having mod_perl show his warnings: setting PerlWarn to On,
 nothing appears into the ErrorLog.
 I tried to change che LogLevel down to "debug": other messages do appear,
 but not the perl warnings.
 
 I'm using Perl 5.6.0, mod_perl 1.24, apache 1.3.12 as localhost. The same
 script issues warnings, as expected, using linux as web-server.
 
 This is the area in my httpd.conf file:
 ---
 LoadModule perl_module modules/ApacheModulePerl.dll
 PerlWarn On
 ScriptAlias /perl/test/ q:/web/perl/test/
 Location /perl/test
 SetHandler perl-script
 PerlHandler Apache::Registry
 PerlSendHeader On
 Options +ExecCGI
 /Location
 ---
 
 What am I missing ?
 Any help would be appreciated, thanks.
 Franco
 

Hi,
Can you supply a stripped down version of a script
which illustrates this? On my Win32, PerlWarn works
with a simple script:
   #!/Perl/bin/perl.exe
   print "Content-type: text/html\n\n";
   my $x; 
   print "$xBR";
This is with the current cvs mod_perl version, though.
Are you also running perl-5.6.0/mod_perl-1.24/apache_1.3.12
on your linux machine?

best regards,
randy kobes





Re: Patch for easy testing of Apache::* modules (resend)

2000-10-10 Thread Ken Williams

[EMAIL PROTECTED] (Doug MacEachern) wrote:
ken, i have a feature request too :)  i would like to be able to test if
mod_include is linked static with httpd, otherwise Makefile.PL will
disable PERL_SSI.  a hash of parsed `httpd -l`, something like:

my $static_modules = Apache::test-http_static_modules;

if ($static_modules-{mod_include}) {
...
}

Okey dokey Doug, here's a patch.  I cleaned up _read_existing_conf()
too because it was pretty hard to understand.

===
RCS file: /home/cvspublic/modperl/lib/Apache/test.pm,v
retrieving revision 1.19
diff -u -r1.19 test.pm
--- test.pm 2000/10/02 21:06:19 1.19
+++ test.pm 2000/10/10 06:47:00
@@ -138,13 +138,12 @@
 }
 
 sub _read_existing_conf {
-# Returns some config text 
-shift;
-my ($server_conf) = @_;
+# Returns some "(Add|Load)Module" config lines, generated from the
+# existing config file and a few must-have modules.
+my ($self, $server_conf) = @_;
 
-
 open SERVER_CONF, $server_conf or die "Couldn't open $server_conf: $!";
-my @lines = grep {!m/^\s*#/} SERVER_CONF;
+my @lines = grep {!m/^\s*\#/} SERVER_CONF;
 close SERVER_CONF;
 
 my @modules   =   grep /^\s*(Add|Load)Module/, @lines;
@@ -154,41 +153,47 @@
 foreach (@modules) {
s!(\s)([^/\s]\S+/)!$1$server_root/$2!;
 }
-
-# Directories where apache DSOs live.
-my (@module_dirs) = map {m,(/\S*/),} @modules;
-
-# Have to make sure that dir, autoindex and perl are loaded.
-my @required  = qw(dir autoindex perl);
 
-my @l = `t/httpd -l`;
-my @compiled_in = map /^\s*(\S+)/, @l[1..@l-2];
+my $static_mods = $self-static_modules('t/httpd');
 
 my @load;
-foreach my $module (@required) {
-   if (!grep /$module/i, @compiled_in, @modules) {
+# Have to make sure that dir, autoindex and perl are loaded.
+foreach my $module (qw(dir autoindex perl)) {
+   unless ($static_mods-{"mod_$module"} or grep /$module/i, @modules) {
+   warn "Will attempt to load mod_$module dynamically.\n";
push @load, $module;
}
 }
 
+# Directories where apache DSOs live.
+my @module_dirs = map {m,(/\S*/),} @modules;
+
 # Finally compute the directives to load modules that need to be loaded.
  MODULE:
 foreach my $module (@load) {
foreach my $module_dir (@module_dirs) {
-   if (-e "$module_dir/mod_$module.so") {
-   push @modules, "LoadModule ${module}_module 
$module_dir/mod_$module.so\n"; next MODULE;
-   } elsif (-e "$module_dir/lib$module.so") {
-   push @modules, "LoadModule ${module}_module 
$module_dir/lib$module.so\n"; next MODULE;
-   } elsif (-e "$module_dir/ApacheModule\u$module.dll") {
-   push @modules, "LoadModule ${module}_module 
$module_dir/ApacheModule\u$module.dll\n"; next
MODULE;
+   foreach my $filename ("mod_$module.so", "lib$module.so", 
+"ApacheModule\u$module.dll") {
+   if (-e "$module_dir/$filename") {
+   push @modules, "LoadModule ${module}_module 
+$module_dir/$filename\n"; next MODULE;
+   }
}
}
+   warn "Warning: couldn't find anything to load for 'mod_$module'.\n";
 }
- 
-print "found the following modules: \n@modules";
+
+print "Adding the following dynamic config lines: \n@modules";
 return join '', @modules;
 }
 
+sub static_modules {
+# Returns a hashref whose keys are each of the modules compiled
+# statically into the given httpd binary.
+my ($self, $httpd) = @_;
+
+my @l = `$httpd -l`;
+return {map {lc($_) = 1} map /(\S+)\.c/, @l};
+}
+
 # Find an executable in the PATH.
 sub which {
 foreach (map { "$_/$_[0]" } split /:/, $ENV{PATH}) {
@@ -628,6 +633,14 @@
 response.  In a list context, fetch() returns the content and the
 HTTP::Response object itself.  This can be handy if you need to check
 the response headers, or the HTTP return code, or whatever.
+
+=head2 static_modules
+
+ Example: $mods = Apache::test-static_modules('/path/to/httpd');
+
+This method returns a hashref whose keys are all the modules
+statically compiled into the given httpd binary.  The corresponding
+values are all 1.
 
 =head1 EXAMPLES
 
===

  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum





Embeded perl question

2000-10-10 Thread Genocchio, Anthony

I am having trouble returing a variable from a sub?...below is my effort to
do this...is there some fundamental place where i am going wrong and can you
help me?!...thanks

[$  sub get_date $]
[-  
$var = shift;
$path = ("/home/genoccaj/public_html/lookup/");
use File::stat;
$inode = stat($path.$var) or die "Couldn't stat file : $!";
$mtime = $inode-mtime;
$size = $inode-size;   

use Time::localtime;
$tm = localtime($mtime);
$year = $tm-year+1900;
$month = $tm-mon;
$mday = $tm-mday;
@months =
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
$mth = $months[$month];
$date = ($mday."-".$mth."-".$year);
return[$date];
-]
[+ $date +]BR
[+ $var +]BR
[$ endsub $]

[-
use DirHandle;
$path = ("/home/genoccaj/public_html/lookup/");
%files = ();
%filedates = ();

opendir(TXT, $path);
while (defined($file = readdir TXT )) {
if ($file =~ /states/  $file !~ /zip/ ) {
$filedates{states} = get_date($file)
}
if ($file =~ /nacs/  $file !~ /zip/ ) {
$filedates{nacs} = get_date($file)
}
}   
closedir(TXT);

-]
[+ $filedates{states} +]BR
[+ $filedates{nacs} +]BR



Re: XML::Parse segmentation fault

2000-10-10 Thread Matt Sergeant

On Mon, 9 Oct 2000, Herrington, Jack wrote:

 Is there some inherint problem with XML::Parser and mod_perl?

Yes. You need to recompile Apache with RULE_EXPAT=no.

I'm hoping that now that expat has a standard distribution that the Apache
team will be proactive in fixing this bug.

-- 
Matt/

/||** Director and CTO **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** Personal Web Site: http://sergeant.org/ **
 \\//
 //\\
//  \\




RE: :Parse segmentation fault

2000-10-10 Thread Matt Sergeant

On Mon, 9 Oct 2000, Herrington, Jack wrote:

 This allows for XML parsing with no change to the Perl code.  I'm just not
 sure what I am losing in Apache (which is where I make the change).  What
 does losing EXPAT do to Apache?

You lose mod_dav, and maybe future modules that use the built in expat
support. But nothing serious.

-- 
Matt/

/||** Director and CTO **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** Personal Web Site: http://sergeant.org/ **
 \\//
 //\\
//  \\




Can't get 'PerlAuthenHandler' to work.

2000-10-10 Thread Ariel Manzur

Hi..

I wrote a module that asks for authentication, and sets enviroment
variables with the username and password, and returns "OK" (I do the actual
authentication on a CGI script later). I put this on the .htaccess file:

AuthType  Basic
AuthName  "Name of the Authentcation Realm"
Require   valid-user
PerlAuthenHandler AuthEnv

('AuthEnv' is the name of the module), but apache still authenticates
against the system passwords (/etc/passwd), and the module doesn't appear
to be running. What is the correct way to use PerlAuthenHandler?

Thanks.. Bye.

Ariel.





Re: Can't get 'PerlAuthenHandler' to work.

2000-10-10 Thread Ian Frawley

Hello Ariel

When you return "OK" from your authentication module that gives apache the
thumbs up authentication accepted. So possibly you might be trying to
authenticate a user that has already been authenticated when you run your
CGI script.

Ian

- Original Message -
From: "Ariel Manzur" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 09, 2000 8:37 PM
Subject: Can't get 'PerlAuthenHandler' to work.


 Hi..

 I wrote a module that asks for authentication, and sets enviroment
 variables with the username and password, and returns "OK" (I do the
actual
 authentication on a CGI script later). I put this on the .htaccess file:

 AuthType  Basic
 AuthName  "Name of the Authentcation Realm"
 Require   valid-user
 PerlAuthenHandler AuthEnv

 ('AuthEnv' is the name of the module), but apache still authenticates
 against the system passwords (/etc/passwd), and the module doesn't appear
 to be running. What is the correct way to use PerlAuthenHandler?

 Thanks.. Bye.

 Ariel.






Spawning

2000-10-10 Thread atli

Hi there,
 I am working on a web-oriented game that runs on Apache/modperl and
MySQL. I have one perl process that runs forever and is outside of Apache
that does a lot of tallying up and cleaning. I want the process to be
started by Apache on server startup and give the process access to Apache
much like a normal modperl script. Is this possible?
 Atli.
p.s. I was able to achieve something similar by placing the script in my
modules directory and simply calling it from a browser. The script never
returns so the browser hangs but at least the script runs. This is however
rather messy and obviously not a method I want to use.





Re: Spawning

2000-10-10 Thread Greg Cope

[EMAIL PROTECTED] wrote:
 
 Hi there,
  I am working on a web-oriented game that runs on Apache/modperl and
 MySQL. I have one perl process that runs forever and is outside of Apache
 that does a lot of tallying up and cleaning. I want the process to be
 started by Apache on server startup and give the process access to Apache
 much like a normal modperl script. Is this possible?
  Atli.

I would always seperate any proccess that are not web request orientated
outside the request architecture - i.e write your own daemon / crond
script thats does this exterior processing.

What do you need to access apache internals for ?

Starting something on startup is just a question of adding the required
lines to the server startup script.

 p.s. I was able to achieve something similar by placing the script in my
 modules directory and simply calling it from a browser. The script never
 returns so the browser hangs but at least the script runs. This is however
 rather messy and obviously not a method I want to use.

Not highly recomended but what about an exec / system call from the
startup.pl ? (as root remeber!).

Greg Cope



Problem configuring handler in httpd.conf.

2000-10-10 Thread Todd Chapman


I am trying to set up httpd.conf so that documents in
/home/httpd/html/mason are handled by HTML::Mason but documents in
/home/httpd/html/mason/perl are handled by Apache::Registry.

The problems in that while Mason works, the Apache::Registry cgi programs
are getting dumped as plain text instead of executed.

If it matters, I am changing $r-filename in my PerlAuthzHandler.

Here is the section from httpd.conf:

Alias /mason /home/httpd/html/mason
Perlrequire /etc/httpd/conf/handler.pl
Directory /home/httpd/html/mason
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options +ExecCGI
/Directory

Directory /home/httpd/html/mason/perl
PerlHeaderParserHandler Apache::SetRealm
AuthType Basic
PerlAuthenHandler Apache::CheckPass
PerlAuthzHandler  Apache::CheckAccess
require valid-user
SetHandler perl-script
PerlHandler HTML::Mason
/Directory


Thanks for any help.

-Todd





Re: Spawning

2000-10-10 Thread atli



I would always seperate any proccess that are not web request orientated
outside the request architecture - i.e write your own daemon / crond
script thats does this exterior processing.

I totally agree. That's the plan but I need the Apache connection for the
external processing

What do you need to access apache internals for ?

I have an object(package) that can only have one instance running. That
object is currently created by startup.pl. I need to access that instance
from apache modules
AND the external script.

Starting something on startup is just a question of adding the required
lines to the server startup script.

Yup, I did that and it works fine. Just need to make that connection. I
don't think calling system(...) in startup.pl  and setsid() in the script
would help because that would just start up another perl session
disconnected from Apache... am I right? I am unfortunately not too familiar
with the intricacies of the Perl/Apache connection.
 Atli.






Re: PerlWarn On being ignored on win32

2000-10-10 Thread Franco . Radice


On Mon, 9 Oct 2000 [EMAIL PROTECTED] wrote:

 Hi,
 I have problems having mod_perl show his warnings: setting PerlWarn to
On,
 nothing appears into the ErrorLog.
 I tried to change che LogLevel down to "debug": other messages do appear,
 but not the perl warnings.

 I'm using Perl 5.6.0, mod_perl 1.24, apache 1.3.12 as localhost. The same
 script issues warnings, as expected, using linux as web-server.

 This is the area in my httpd.conf file:

---

 LoadModule perl_module modules/ApacheModulePerl.dll
 PerlWarn On
 ScriptAlias /perl/test/ q:/web/perl/test/
 Location /perl/test
 SetHandler perl-script
 PerlHandler Apache::Registry
 PerlSendHeader On
 Options +ExecCGI
 /Location

---


 What am I missing ?
 Any help would be appreciated, thanks.
 Franco


 Can you supply a stripped down version of a script which illustrates
this?
 On my Win32, PerlWarn works with a simple script:
   #!/Perl/bin/perl.exe
   print "Content-type: text/html\n\n";
   my $x;
   print "$xBR";
Randy,
my script was very similar to the one you provide.
I tried your script with the Perl I'm using obtaining:

Q:\web\perl\testperl simple.pl
Content-type: text/html

Use of uninitialized value in concatenation (.) at simple.pl line 5.
BR
Q:\web\perl\test

This make me think that the Perl executables is ok.
The execution of your script makes an HTML containing a BR but non
warnings.

I tried Apache with MOD_PERL_TRACE=1 obtaining:

D:\apacheapache
perl_parse args: '-w' 'nul' ...allocating perl interpreter...ok
constructing perl interpreter...ok
ok
running perl interpreter...ok
mod_perl: 0 END blocks encountered during server startup
loading perl module 'Apache'...loading perl module
'Apache::Constants::Exports'...ok
ok
mod_perl: calling perl_startup()
init `PerlHandler' stack
perl_cmd_push_handlers: @PerlHandler, 'Apache::Registry'
pushing `Apache::Registry' into `PerlHandler' handlers
perl_cmd_warn: 1
perl_cmd_setenv: 'test' = 'works'
loading perl module 'Apache'...ok
perl_startup: perl aleady running...ok
IBM_HTTP_Server/1.3.12.1 Apache/1.3.12 (Win32) mod_perl/1.24 running...

The WEB server works fine, and so Perl with mod_perl, apart the warning
stuff. In the example above I was also using an environment variable that
can be later displayed by a Perl script dumping %ENV as an HTML table.

I tried to recompile carefully perl, apache and mod_perl but I cannot
figure the problem.

I tried to use the latest mod_perl version under CVS, with the same
problem: everything works beside warnings.

This are the versions I'm using:

D:\apacheapache -V
Server version: IBM_HTTP_Server/1.3.12.1 Apache/1.3.12 (Win32)
Server built:   Sep 14 2000 03:35:15
Server's Module Magic Number: 19990320:8
Server compiled with
 -D HAVE_MMAP
 -D USE_MMAP_SCOREBOARD
 -D NO_WRITEV
 -D NO_OTHER_CHILD
 -D NO_RELIABLE_PIPED_LOGS
 -D MULTITHREAD
 -D HTTPD_ROOT="/apache"
 -D SUEXEC_BIN="/apache/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_XFERLOG="logs/access.log"
 -D DEFAULT_ERRORLOG="logs/error.log"
 -D TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
 -D ACCESS_CONFIG_FILE="conf/access.conf"
 -D RESOURCE_CONFIG_FILE="conf/srm.conf"

Q:\web\perl\testperl -V
Summary of my perl5 (revision 5 version 6 subversion 0) configuration:
  Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
cc='cl', optimize='-Od -MD -DNDEBUG', gccversion=
cppflags='-DWIN32'
ccflags ='-Od -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT
-DPERL_MSVCRT_READFIX'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -release  -libpath:"c:
\ar\wkst\bin\perl\5.6.0\lib\MSWin32-x86\CORE"  -machine:x86'
libpth=C:\PROGRA~1\MICROS~2\VC98\lib
libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib 

RE: XML::Parse segmentation fault

2000-10-10 Thread Geoffrey Young



 -Original Message-
 From: Matt Sergeant [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, October 10, 2000 3:20 AM
 To: Herrington, Jack
 Cc: '[EMAIL PROTECTED]'
 Subject: Re: XML::Parse segmentation fault
 
 
 On Mon, 9 Oct 2000, Herrington, Jack wrote:
 
  Is there some inherint problem with XML::Parser and mod_perl?
 
 Yes. You need to recompile Apache with RULE_EXPAT=no.

according to Changes, this should be automatic as of 1.23...

are you using an older version or are the conflicts still aparent in 1.23 or
1.24?

--Geoff

 
 I'm hoping that now that expat has a standard distribution 
 that the Apache
 team will be proactive in fixing this bug.
 
 -- 
 Matt/
 
 /||** Director and CTO **
//||**  AxKit.com Ltd   **  ** XML Application Serving **
   // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
  // \\| // ** Personal Web Site: http://sergeant.org/ **
  \\//
  //\\
 //  \\
 



[Available for a Job] mod_perl/Oracle/linux/web guru

2000-10-10 Thread David Harris


I'm looking for a mod_perl consulting job anywhere from two weeks to a month
long. I'm available starting at the beginning of next week, and I can work
remotely or fly out to your location.

I am a mod_perl, Oracle, web database, and Linux guru. I've contributed to
mod_ssl, mod_perl, Apache, and RedHat projects as well as being a CPAN author.
Also started a number of small open source projects of my own at
www.davideous.com.

Find more information on what I can do for you at:

   http://www.davideous.com/statement_of_capabilities.txt

(Stas gave a thumbs-up for posting job availability on this list back on
8/10/2000, so I figured I'd let the list know.)

David






Re: PerlWarn On being ignored on win32

2000-10-10 Thread Randy Kobes

On Tue, 10 Oct 2000 [EMAIL PROTECTED] wrote:
[ .. ]
  On my Win32, PerlWarn works with a simple script:
#!/Perl/bin/perl.exe
print "Content-type: text/html\n\n";
my $x;
print "$xBR";
 Randy,
 my script was very similar to the one you provide.
 I tried your script with the Perl I'm using obtaining:
 
 Q:\web\perl\testperl simple.pl
 Content-type: text/html
 
 Use of uninitialized value in concatenation (.) at simple.pl line 5.
 BR
 Q:\web\perl\test
 
 This make me think that the Perl executables is ok.
 The execution of your script makes an HTML containing a BR but non
 warnings.
[ ... ]

Hi,
   If you have fatal errors, do these get logged OK in the
server's error log? Also, what happens if you use the CGI::Carp 
module, either directing things to the same or another
error log file, or perhaps by trying the warningsToBrowser()
function, which embeds warnings in HTML comments.

best regards,
randy kobes




RE: XML::Parse segmentation fault

2000-10-10 Thread Matt Sergeant

On Tue, 10 Oct 2000, Geoffrey Young wrote:

  On Mon, 9 Oct 2000, Herrington, Jack wrote:
  
   Is there some inherint problem with XML::Parser and mod_perl?
  
  Yes. You need to recompile Apache with RULE_EXPAT=no.
 
 according to Changes, this should be automatic as of 1.23...

Of course only if you compile Apache from mod_perl's Makefile.PL.

From what I've heard, Greg Stein is now aware of the problem and willing
to work it out for the next Apache release. But whether that happens
remains to be seen...

-- 
Matt/

/||** Director and CTO **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** Personal Web Site: http://sergeant.org/ **
 \\//
 //\\
//  \\




Re: Problem configuring handler in httpd.conf.

2000-10-10 Thread Perrin Harkins

On Tue, 10 Oct 2000, Todd Chapman wrote:
 I am trying to set up httpd.conf so that documents in
 /home/httpd/html/mason are handled by HTML::Mason but documents in
 /home/httpd/html/mason/perl are handled by Apache::Registry.
 
 The problems in that while Mason works, the Apache::Registry cgi programs
 are getting dumped as plain text instead of executed.
 
 If it matters, I am changing $r-filename in my PerlAuthzHandler.
 
 Here is the section from httpd.conf:
 
 Alias /mason /home/httpd/html/mason
 Perlrequire /etc/httpd/conf/handler.pl
 Directory /home/httpd/html/mason
 SetHandler perl-script
 PerlHandler Apache::Registry
 PerlSendHeader On
 Options +ExecCGI
 /Directory
 
 Directory /home/httpd/html/mason/perl
 PerlHeaderParserHandler Apache::SetRealm
 AuthType Basic
 PerlAuthenHandler Apache::CheckPass
 PerlAuthzHandler  Apache::CheckAccess
 require valid-user
 SetHandler perl-script
 PerlHandler HTML::Mason
 /Directory

It looks to me like you have this set up backwards.  It's going to serve
~httpd/html/mason/perl with Mason and ~httpd/html/mason with
Apache::Registry.  Is that what you meant to do?

- Perrin




Strangeness with Carp under mod_perl

2000-10-10 Thread darren chamberlain

Hi All.

This is a curiosity question, mostly. I have a simple method of sending
debugging messages to the error log:

use constant DEBUG = 1; # Set to 0 to turn off debugging throughout
sub debug ($) {
if (DEBUG) {
return carp sprintf "[%s] [%s] %s", scalar caller, scalar localtime, shift;
}
return 1;
}

which gets called as:

debug("Entering handler");

and in scripts, I get nicely formatted output (I split the lines here):

[BGEP::Utils] [Tue Oct 10 13:24:33 2000] Getting date list at
  /usr/local/bin/foo.pl line 22
  

But under mod_perl, I'm getting:

[BGEP::TestPkg] [Tue Oct 10 13:17:00 2000] Sending message to
 '[EMAIL PROTECTED]' at /dev/null line 0
 

The thing that's throwing me off is the '/dev/null line 0' part. (This
example is logging the use Mail::Sendmail.)

Any ideas as to why this is being reported like this? It is being called
from with a handler, not from /dev/null. :)

Environment:

Linux 2.2.17 (i686)
Perl 5.6.0
Apache 1.3.12/mod_perl 1.24

(All built from scratch.)

(darren)

-- 
To do nothing is to be nothing.



Re: Strangeness with Carp under mod_perl

2000-10-10 Thread Honza Pazdziora

On Tue, Oct 10, 2000 at 01:33:03PM -0400, darren chamberlain wrote:
 
 Any ideas as to why this is being reported like this? It is being called
 from with a handler, not from /dev/null. :)

Because there isn't any actual file associated from the handler. It's
just a code being executed, with no real context in $0.

-- 

 Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/
 .project: Perl, mod_perl, DBI, Oracle, auth. WWW servers, XML/XSL, ...




How late can $r-filename be set?

2000-10-10 Thread Todd Chapman


Can I set $r-filename at the end of an PerlAuthzhandler?

Thanks.

-Todd






Re: Embeded perl question

2000-10-10 Thread ___cliff rayman___

embperl 'subs' do not return subroutine values.
you need to either make a regular subroutine
[- sub get_date { ... } -]

or use a global variable for return values. such as @GLOBAL.   kind of ugly - but is it
any uglier than @_ for the input values?

"Genocchio, Anthony" wrote:

 I am having trouble returing a variable from a sub?...below is my effort to
 do this...is there some fundamental place where i am going wrong and can you
 help me?!...thanks

 [$  sub get_date $]
 [-
 $var = shift;
 --snip---
 $date = ($mday."-".$mth."-".$year);
 return[$date];
 -]
 [+ $date +]BR
 [+ $var +]BR
 [$ endsub $]

 [-
 use DirHandle;

--
___cliff [EMAIL PROTECTED]http://www.genwax.com/





Compiling apache staticly with mod_perl.

2000-10-10 Thread Peter Gebauer

Hey!

I've been trying to compile apache together with mod_perl using this
configuration:

./configure --prefix=/home/httpd
--activate-module=src/modules/perl/libperl.a

I get several errors during the make where the compiler complains about
mod_perl reffering to undefined functions.

The INSTALL and README's for mod_perl are not easy to follow and I've been
trying to do them step by step, which is not easy when the document
is written poorly. It's hard to know what is "by-hand-installation" and
what is done automaticly.

I have compiled a lot of stuff staticly with Apache and they all work
fine, only mod_perl has given me problems.
Since I have these other modules I need as well, I can't use the Makefiles
for Apache that mod_perl creates when answering YES on the "Create
httpd" question.
I do not have LWP installed, but the configuration files said it wasn't
needed.

Did anybody compile Apache + mod_perl + other modules or have
documentation that is written for this specific purpouse (since the
INSTALL file that comes with mod_perl is totally insufficient)?

Thanks!




RE: Compiling apache staticly with mod_perl.

2000-10-10 Thread Geoffrey Young



 -Original Message-
 From: Peter Gebauer [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, October 10, 2000 8:20 AM
 To: [EMAIL PROTECTED]
 Subject: Compiling apache staticly with mod_perl.
 
[snip]
 
 Did anybody compile Apache + mod_perl + other modules or have
 documentation that is written for this specific purpouse (since the
 INSTALL file that comes with mod_perl is totally insufficient)?

http://perl.apache.org/guide/install.html

in general, the guide full of lots of good information for mod_perl users...

HTH

--Geoff

 
 Thanks!
 



Re: Compiling apache staticly with mod_perl.

2000-10-10 Thread Paul Lindner

On Tue, Oct 10, 2000 at 02:43:36PM -0400, Geoffrey Young wrote:
 
 
  -Original Message-
  From: Peter Gebauer [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, October 10, 2000 8:20 AM
  To: [EMAIL PROTECTED]
  Subject: Compiling apache staticly with mod_perl.
  
 [snip]
  
  Did anybody compile Apache + mod_perl + other modules or have
  documentation that is written for this specific purpouse (since the
  INSTALL file that comes with mod_perl is totally insufficient)?
 
 http://perl.apache.org/guide/install.html
 
 in general, the guide full of lots of good information for mod_perl users...

Also see the following URLs

http://people.redhat.com/plindner/apache/apache-heavy-1.3.12-3.i386.rpm
http://people.redhat.com/plindner/apache/apache-heavy-1.3.12-3.src.rpm

For a statically linked RPM.

-- 
Paul Lindner
[EMAIL PROTECTED]
Red Hat Inc.



Apache::Constants non-mod_perl

2000-10-10 Thread Bill Moseley


I'm curious: why I can't use Apache::Constants outside of mod_perl?

%perl -w
use strict;
use Apache::Constants qw/OK/;
print OK;
Undefined subroutine Apache::Constants::OK called at - line 2.



Bill Moseley
mailto:[EMAIL PROTECTED]



OT: mime-type for CSV

2000-10-10 Thread Robert Friberg


Hi all,

I have a handler that returns data in CSV-format. How can
I persuade browsers to suggest a fileextension of .csv

All the users are known and have MS Excel on their windoze
boxes.


regards,

--
robert friberg, ensofus ab




Bugs database?

2000-10-10 Thread Todd Chapman


Is there a mod_perl bugs database? I am having a problem and I want to
make sure it isn't a bug in mod_perl that's fixed in a recent release.

Thanks.

-Todd

P.S. The bug is that $r-connection-user() is not set when I return OK
from my PerlAuthenHandler. I have to set it manually. Why would that be?

package Apache::CheckPass;

## Usage: PerlAuthenHandler Apache::CheckPass

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

sub handler {

my $r = shift;

$r-notes('CheckPass' = 'Ran!');

my $authen = new HTTPD::Authen::Basic();
my @info = $authen-parse($r-header_in('Authorization'));

$r-notes('USERNAME' = $info[0]);
$r-notes('AUTH' = 1);

#return OK if checkpass($r-notes('REALM'), @info);
if (checkpass($r-notes('REALM'), @info)) {
$r-notes('CheckPass' = 'Verified!');
$r-connection-user($info[0]);
return OK;
}

$r-auth_name($r-notes('REALM'));
$r-note_basic_auth_failure;
return AUTH_REQUIRED;

}

sub checkpass {

my $realm = shift;
my $username = shift;
my $password = shift;

my $db = HTTPD::RealmManager-open(-realm = $realm,
   -config_file = '/etc/httpd/conf/realms.conf',
   -writable = 0,
   -server   = 'apache');

return $db-passwd(-user=$username,-password=$password);

}


1;





RE: mime-type for CSV

2000-10-10 Thread mgraham


I use the following (not sure about the actual content-type, but it
seems to work

Content-Type: text/x-csv
Content-Disposition: attachment; filename=somefile.csv

Michael


 -Original Message-
 From: Robert Friberg [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, October 10, 2000 4:17 PM
 To: modperl-lista
 Subject: OT: mime-type for CSV



 Hi all,

 I have a handler that returns data in CSV-format. How can
 I persuade browsers to suggest a fileextension of .csv

 All the users are known and have MS Excel on their windoze
 boxes.


 regards,

 --
 robert friberg, ensofus ab




Re: mime-type for CSV

2000-10-10 Thread David M. Davisson

- Original Message - 
From: "Robert Friberg" [EMAIL PROTECTED]
To: "modperl-lista" [EMAIL PROTECTED]
Sent: Tuesday, October 10, 2000 1:16 PM
Subject: OT: mime-type for CSV


 
 Hi all,
 
 I have a handler that returns data in CSV-format. How can
 I persuade browsers to suggest a fileextension of .csv
 
 All the users are known and have MS Excel on their windoze
 boxes.

Try:

application/vnd.ms-excelxls csv

---
David M. Davisson
[EMAIL PROTECTED]







Re: Spawning

2000-10-10 Thread bcburke

You can use Perl's IPC::Shareable to share objects in memory across
processes:
http://theoryx5.uwinnipeg.ca/CPAN/data/IPC-Shareable/IPC/Shareable.html

Good luck,
Brian B.
[EMAIL PROTECTED]

- Original Message -
From: [EMAIL PROTECTED]
To: Greg Cope [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, October 11, 2000 10:11 AM
Subject: Re: Spawning




 I would always seperate any proccess that are not web request orientated
 outside the request architecture - i.e write your own daemon / crond
 script thats does this exterior processing.

 I totally agree. That's the plan but I need the Apache connection for the
 external processing

 What do you need to access apache internals for ?

 I have an object(package) that can only have one instance running. That
 object is currently created by startup.pl. I need to access that instance
 from apache modules
 AND the external script.

 Starting something on startup is just a question of adding the required
 lines to the server startup script.

 Yup, I did that and it works fine. Just need to make that connection. I
 don't think calling system(...) in startup.pl  and setsid() in the script
 would help because that would just start up another perl session
 disconnected from Apache... am I right? I am unfortunately not too
familiar
 with the intricacies of the Perl/Apache connection.
  Atli.







Wild Proposal :)

2000-10-10 Thread Ajit Deshpande

The following is a half-baked proposal for a wild idea. Please comment on
this. If the powers that be think this is OT, then please move this I
will take it elsewhere.

If this is something that is already implemented by 'Application Foo' or
'System Bar' then please let me know and you will hear no more :)

Ajit

OBJECTIVE

Provide a perl server that can execute miscellaneous perl jobs that 
will communicate with mod_perl enabled Apache kids using IPC. This
can be considered something similar to a master "Servlet" but in perl;
call it Perlet. The master Perlet can manage a pool of kid Perlets that
will be governed by the load.

MOTIVATIONS

- Modperl in Apache 1.x does not provide a good way of sharing data
  and operations on that data in an efficient manner between Apache kids.

- We often want to execute perl jobs in Apache kids but do not want to
  incur the expense of forking a perl interpreter.

- Trying to stuff everything into packages and loading in the parent
  Apache has limitations.

IMPLEMENTATION

I have no idea :). I am an intermediate perl programmer, but can take a
stab at this after getting some feedback on this RFC.

EXAMPLE USES

The following are probably a bit ambitious. #2 and #3 are something that
I can see implementing fairly easily. The most important thing would of
course be the design of the API between mod_perl Apache and a Perlet.

- Perlet::DB that will provide a pool of database connections and
  miscellaneous DB querying etc.

- Perlet::Mail that will provide asynchronous Mail handoffs

- Perlet::Data that will provide some in-memory datastore that can
  be used for looking up codes etc. Example: list of 50 states in the US
  used to populate SELECT forms in html page. list of countries.
  Anonymous hash references and subs on that data to return specific
  values. Example: numerical IDs corresponding to a SELECT list. 

- Perlet::Java::Servlet : Mechanism to communicate with Java Servlets

- Perlet::XML::Parser : XML Parser 

- Perlet::HTML::Parser : HTML Parser

- Perlet::CyberCash : Communicate with the Cybercash server



mod_perl on RH7 fails make test

2000-10-10 Thread falstaff


I am trying to build mod_perl-1.24 on apache_1.3.12 on 
RedHat linux 7.0 2.2.16-22  gcc version 2.96
All seems to build fine, but when I run make test it fails to start
the server with lock error :

[notice] Destruction-DESTROY called for $global_object
[Fri Oct  6 10:39:06 2000] [warn] [notice] child_init for process 3211, report any 
problems to [no address given]
[Fri Oct  6 10:39:06 2000] [emerg] (22)Invalid argument: fcntl: F_SETLKW: Error 
getting accept lock, exiting!  Perhaps you need to use the LockFile directive to place 
your lock file on a local disk!
[notice] child process 3211 terminating
[notice] push'd PerlChildExitHandler called, pid=3211
[notice] push'd PerlChildExitHandler called, pid=3211
[notice] END block called for startup.pl
[notice] Destruction-DESTROY called for $global_object

Any help, hints or pointers appreciated.

-- 
Danny Aldham Providing Certified Internetworking Solutions to Business
www.postino.com  E-Mail, Web Servers, Web Databases, SQL PHP  Perl




Re: Wild Proposal :)

2000-10-10 Thread Perrin Harkins

Hi Ajit,

It's not entirely clear to me what problem you're trying to solve here. 
I'll comment on some of the specifics you've written down here, but I
may be missing your larger point.

 OBJECTIVE
 
 Provide a perl server that can execute miscellaneous perl jobs that
 will communicate with mod_perl enabled Apache kids using IPC. This
 can be considered something similar to a master "Servlet" but in perl;
 call it Perlet. The master Perlet can manage a pool of kid Perlets that
 will be governed by the load.

You can do this fairly easily using RPC::PlServer or one of the other
RPC modules on CPAN.  This is how DBI::Proxy works.

 MOTIVATIONS
 
 - Modperl in Apache 1.x does not provide a good way of sharing data
   and operations on that data in an efficient manner between Apache kids.

They may not perform quite as well as multi-threading, but there are a
number of modules that solve this problem pretty well.  Apache::Session
is one example, and there are many shared cache modules out there. 
Using the file system for this is a pretty good solution on systems that
do aggressive memory buffering of the file system, like Linux.  (We were
just talking about this stuff on the Mason list.  Seems like almost as
popular a topic as templating systems.)

One thing to keep in mind is that any perl server is likely to use a
multi-process approach and thus will have the same issues with data
sharing that mod_perl does.  You'd have to get production quality
multi-threading support in Perl to avoid this, or write  server that
multiplexes using select calls and non-blocking I/O.

 EXAMPLE USES
 
 The following are probably a bit ambitious. #2 and #3 are something that
 I can see implementing fairly easily. The most important thing would of
 course be the design of the API between mod_perl Apache and a Perlet.
 
 - Perlet::DB that will provide a pool of database connections and
   miscellaneous DB querying etc.

There's DBI::Proxy already.  Before jumping on the "we need pooled
connections" bandwagon, you should read Jeffrey Baker's post on the
subject here:
http:[EMAIL PROTECTED]

 - Perlet::Mail that will provide asynchronous Mail handoffs

qmail-inject will cover this.

The other examples (HTML/XML parsers) don't make sense to me, since
these work fine with mod_perl and are generally synchronous
applications.

- Perrin