Re: mod_perl v2 Forking

2003-09-15 Thread Martin Langhoff
Cameron,

Have you tried issuing the command to `at`?  If you don't need to 
interact wih the report generator, and can pass all the parameters in 
the command line or via a tmp file, this is a great solution.

at (and the corresponding atd) will preserve your environment vars and 
other niceties.

regards,





martin



syntax error ... near compile qw(:common)

2003-08-25 Thread Harold Martin
Hello,
When I try to start up Apache, I get the error:
[error] syntax error at /usr/lib/perl5/site_perl/5.8.0/ProMP3.pm line 8,
near compile qw(:common)
Compilation failed in require at /etc/httpd/promp3/promp3.handler.pl
line 6.
BEGIN failed--compilation aborted at /etc/httpd/promp3/promp3.handler.pl
line 6.
Compilation failed in require at (eval 1) line 1.

ProMP3.pm's has:
use Apache2 ();
use Apache::compat;
use Apache::ServerUtil ();
use strict;
use vars qw($VERSION);
use DBI;
use Apache::Const -compile qw(:common);

What do I need to do differently?
Thanks,
Harold


signature.asc
Description: This is a digitally signed message part


Re: syntax error ... near compile qw(:common)

2003-08-25 Thread Harold Martin
On Sun, 2003-08-24 at 17:21, Stas Bekman wrote:
 Harold Martin wrote:
  Hello,
  When I try to start up Apache, I get the error:
  [error] syntax error at /usr/lib/perl5/site_perl/5.8.0/ProMP3.pm line 8,
  near compile qw(:common)
  Compilation failed in require at /etc/httpd/promp3/promp3.handler.pl
  line 6.
  BEGIN failed--compilation aborted at /etc/httpd/promp3/promp3.handler.pl
  line 6.
  Compilation failed in require at (eval 1) line 1.
  
  ProMP3.pm's has:
  use Apache2 ();
  use Apache::compat;
  use Apache::ServerUtil ();
  use strict;
  use vars qw($VERSION);
  use DBI;
  use Apache::Const -compile qw(:common);
 
 where did you find an example of this?
 
 It should be:
 
 use Apache::Const -compile = qw(:common);
 
 or:
 
 use Apache::Const -compile, qw(:common);

The form I used is from the Apache::Const page 
http://perl.apache.org/docs/2.0/api/Apache/Const.html#C__common_

Using either of the two other lines results in the error:
[error] Can't locate # in @INC ...

What's that all about?

Thanks,
Harold


signature.asc
Description: This is a digitally signed message part


Re: syntax error ... near compile qw(:common)

2003-08-25 Thread Harold Martin
On Sun, 2003-08-24 at 18:12, Stas Bekman wrote:
 Harold Martin wrote:
  On Sun, 2003-08-24 at 17:21, Stas Bekman wrote:
  
 Harold Martin wrote:
 
 Hello,
 When I try to start up Apache, I get the error:
 [error] syntax error at /usr/lib/perl5/site_perl/5.8.0/ProMP3.pm
line 8,
 near compile qw(:common)
 Compilation failed in require at
/etc/httpd/promp3/promp3.handler.pl
 line 6.
 BEGIN failed--compilation aborted at
/etc/httpd/promp3/promp3.handler.pl
 line 6.
 Compilation failed in require at (eval 1) line 1.
 
 ProMP3.pm's has:
 use Apache2 ();
 use Apache::compat;
 use Apache::ServerUtil ();
 use strict;
 use vars qw($VERSION);
 use DBI;
 use Apache::Const -compile qw(:common);
 
 where did you find an example of this?
 
 It should be:
 
 use Apache::Const -compile = qw(:common);
 
 or:
 
 use Apache::Const -compile, qw(:common);
  
  
  The form I used is from the Apache::Const page 
  http://perl.apache.org/docs/2.0/api/Apache/Const.html#C__common_
 
 Ah thank you, I've fixed that.
 
  Using either of the two other lines results in the error:
  [error] Can't locate # in @INC ...
  
  What's that all about?
 
 Please post a short test example and a full error message as a part of
a 
 proper bug report as explained here:
 http://perl.apache.org/bugs/

Is there any other way to figure what's wrong? The code isn't mine, but
someone else's, so I'm really not a whole lot of use there. As for
posting an example, it's the same as from
http://sourceforge.net/project/showfiles.php?group_id=12829 but just
modified slightly according to the porting guidelines. I've only changed
and added a few use statements and changed the constants from the m_p 1
form to the m_p 2 from. I've attached the two pieces of code that I
modified (the module and the handler) for you.
Thanks,
Harold


package ProMP3::Config;
use strict;
use Apache2 ();
use Apache::compat;
use Apache::ServerUtil ();
use ProMP3;
my $config;


##
##
## config file for ProMP3
##
## Edit the defaults below if you would like some customization
## 
##

# set the mp3 player to play from the server (must be installed)
$config-{mp3_player} = Xmms;  # valid entries are Xmms for now

# set the database to use in the back end:
$config-{database} = Mysql;   # again, one valid choice: Mysql

# set database username:
$config-{database_username} = root;

# set database password:
$config-{database_secret} = youreouronlyhope;

# set database to use within the database:
# this will match what you tell (told) utils/promp3_setup.pl
$config-{database_db} = music;

# turn on debug, this puts a lot of stuff into the apache error log...
$config-{debug} = 1;

#  Access lists -- set who can do what:
#
# The following are comma seperated access lists of ip addresses.
# They can be in the following form:
#   ip[subnet]
#   i.e.:
# 10.1.1.1/24 (allows 10.1.1.0 thru 10.1.1.255)
# 10.1.1.1/255.255.255.0 (same)
# 10.1.1.0 - 10.1.1.255 (same)
# 10.1.1.50 (only this host, /32 is implied)
#
#  They can be mixed and matched in the same string
#  for example:
#10.1.1.1/24, 192.168.10.48/28, 192.168.10.119, 10.250.1.13-10.250.1.18
# allows 10.1.1.0 thru 10.1.1.255 and 
#192.168.10.48 thru 192.168.10.63 and
#192.168.10.119 and 
#10.250.1.13 thru 10.250.1.18

# Enable streaming mp3, only these IP's will be allowed to stream :
$config-{allow_stream} = 10.10.10.0/24;

# Enable mp3 playing from the server, only these IP's will be able to control the server :
$config-{allow_player} = 10.10.10.1-10.10.10.9, 10.10.10.11-10.10.10.200;

# Allow these folks in, if they aren't in the other list, they'll just be able to look but not touch.
$config-{allow_view} = 0.0.0.0/0;

###
##
## That's all you need to set...
##
###

my @values = qw(allow_stream allow_player allow_view mp3_player database database_username database_secret database_db debug);
foreach my $key (keys %$config) {
  unless (grep /^$key$/, @values) {
delete $config-{$key};
print Warning: $key is being ignored in the promp3 config file\n;
  }
}
foreach my $key (@values) {
  if (! exists $config-{$key}) {
print Warning: $key is not defined in the promp3 config file\n;
$config-{$key} = undef;
  }
}

foreach my $section (qw(allow_stream allow_player allow_view) ) {
  (my $allow = $config-{$section})=~s/\s+//g;
  my @allow = split ',', $allow;
  delete $config-{$section};
  foreach my $string (@allow) {
push @{$config-{$section}}, ProMP3::set_ip_range($string);
if (! defined $config-{$section}[$#{$config-{$section}}]) {
  pop @{$config-{$section}};
}
  }
}
sub get_config {
  return $config-{$_[0]} if (@_);
  return $config;
}

1;
package ProMP3;
use Apache2 ();
use Apache::compat;
use Apache::ServerUtil ();
use strict;
use vars qw($VERSION);
use DBI;
#use Apache::Const -compile qw(:common);
#use Apache::Const -compile = qw(:common);
use Apache::Const -compile

Re: syntax error ... near compile qw(:common)

2003-08-25 Thread Harold Martin
On Sun, 2003-08-24 at 19:46, Stas Bekman wrote:
 Harold Martin wrote:
  On Sun, 2003-08-24 at 18:12, Stas Bekman wrote:
  
 Harold Martin wrote:
 
 On Sun, 2003-08-24 at 17:21, Stas Bekman wrote:
 
 
 Harold Martin wrote:
 
 
 Hello,
 When I try to start up Apache, I get the error:
 [error] syntax error at /usr/lib/perl5/site_perl/5.8.0/ProMP3.pm
  
  line 8,
  
 near compile qw(:common)
 Compilation failed in require at
  
  /etc/httpd/promp3/promp3.handler.pl
  
 line 6.
 BEGIN failed--compilation aborted at
  
  /etc/httpd/promp3/promp3.handler.pl
  
 line 6.
 Compilation failed in require at (eval 1) line 1.
 
 ProMP3.pm's has:
 use Apache2 ();
 use Apache::compat;
 use Apache::ServerUtil ();
 use strict;
 use vars qw($VERSION);
 use DBI;
 use Apache::Const -compile qw(:common);
 
 where did you find an example of this?
 
 It should be:
 
 use Apache::Const -compile = qw(:common);
 
 or:
 
 use Apache::Const -compile, qw(:common);
 
 
 The form I used is from the Apache::Const page 
 http://perl.apache.org/docs/2.0/api/Apache/Const.html#C__common_
 
 Ah thank you, I've fixed that.
 
 
 Using either of the two other lines results in the error:
 [error] Can't locate # in @INC ...
 
 What's that all about?
 
 Please post a short test example and a full error message as a part of
  
  a 
  
 proper bug report as explained here:
 http://perl.apache.org/bugs/
  
  
  Is there any other way to figure what's wrong? The code isn't mine, but
  someone else's, so I'm really not a whole lot of use there. As for
  posting an example, it's the same as from
  http://sourceforge.net/project/showfiles.php?group_id=12829 but just
  modified slightly according to the porting guidelines. I've only changed
  and added a few use statements and changed the constants from the m_p 1
  form to the m_p 2 from. I've attached the two pieces of code that I
  modified (the module and the handler) for you.
 
 Sorry Harold, it doesn't work this way. You ask for help, I ask you for the 
 additional details as described at http://perl.apache.org/bugs/, instead you 
 dump on us 80k of code.
Sorry, I attached the code but my mail program must've converted it into
inline text. 
 I understand that you may not be able to write a short 
 script since you aren't familiar with that code, but at least sending the 
 output of t/REPORT is the least you have to do.
Output of mp2bug it *attached* to this message (if it includes it inline again I'll 
email the developers).
 Nevertheless I did try the attached files and I can't reproduce this problem 
 with the latest cvs. Try upgrading your mod_perl to the latest cvs version, I 
 have no idea which version you have.
I'll use that ASAP.
 One thing that for sure is wrong with that code is that you either use 
 'Apache::compat' and you don't replace Apache::Constants with Apache::Const, 
 or you don't use 'Apache::compat' and then in addition to what you have added 
 (i.e. use Apache::Const -compile = qw(:common);), you need to 
 s/Apache::Constants/Apache::Const/g in the code.
Done and done.
Still getting the same errors as before.

Thanks,
Harold

-8-- Start Bug Report 8--
1. Problem Description:

  [DESCRIBE THE PROBLEM HERE]

2. Used Components and their Configuration:

*** using 
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache/BuildConfig.pm
*** Makefile.PL options:
  MP_APXS= /usr/sbin/apxs
  MP_COMPAT_1X   = 1
  MP_GENERATE_XS = 1
  MP_LIBNAME = mod_perl
  MP_USE_DSO = 1
  MP_USE_STATIC  = 1


*** /usr/sbin/httpd -V
Server version: Apache/2.0.46
Server built:   Aug  6 2003 11:24:31
Server's Module Magic Number: 20020903:3
Architecture:   32-bit
Server compiled with
 -D APACHE_MPM_DIR=server/mpm/prefork
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT=/etc/httpd
 -D SUEXEC_BIN=/usr/sbin/suexec
 -D DEFAULT_PIDLOG=logs/httpd.pid
 -D DEFAULT_SCOREBOARD=logs/apache_runtime_status
 -D DEFAULT_LOCKFILE=logs/accept.lock
 -D DEFAULT_ERRORLOG=logs/error_log
 -D AP_TYPES_CONFIG_FILE=conf/mime.types
 -D SERVER_CONFIG_FILE=conf/httpd.conf


*** /usr/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
osname=linux, osvers=2.4.21-1.1931.2.291.entbigmem, 
archname=i386-linux-thread-multi
uname='linux por'
config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686 
-Dmyhostname=localhost [EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. 
-Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr 
-Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.0 -Duseshrplib -Dusethreads 
-Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm 
-Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005

Errors trying to port (old) mod_perl software

2003-08-22 Thread Harold Martin
Hello,
I'm trying to get some old mod_perl software (namely ProMP3
http://promp3.sourceforge.net/) to work under mod_perl2.
It uses Apache::Constants, but it couldn't find that module (duh), so I
too a stab in the dark and changed it to Apache::Const. When I try to
run that I get the error:
Can't locate # in @INC snip
What? I can't think of ever seeing any modules by that name :} What
should I do next to try and get this program working?
Thanks,
Harold Martin


signature.asc
Description: This is a digitally signed message part


Re: rflush() not working as documented?

2003-08-14 Thread Martin Wickman
On Wed, Aug 06, 2003 at 07:33:49AM -0700, Stas Bekman wrote:
 Martin Wickman wrote:

[...]

 oops, sorry. Can you try with the latest cvs?

Not at the moment. But I'll try in a few days.

 Your particular problem report was fine, what you have missed is the output 
 of t/REPORT which tells us things about your environment. I can't see it 
 here
 http://marc.theaimsgroup.com/?l=apache-modperlm=105968263417468w=2

Sorry, my deb package dont have the t/ stuff.

[...]

 In any case, have you tried using the snooping filter I was talking about 
 in my previous reply? It shows you exactly what's going on inside.

It confirms my problems. Here is output:

 connection output filter
o bucket 1: FLUSH []

 connection output filter
o bucket 1: FLUSH []

 connection output filter
o bucket 1: FLUSH []

 connection output filter
o bucket 1: TRANSIENT 
[htmlhead TITLE /headbody BODY/html]


And here is the code that generates this:

  sub handler {
  my $r = shift;

  $r-content_type('text/html');
  $r-print (htmlhead TITLE /head);
  $r-rflush();
  $r-print (bo);
  $r-rflush();
  $r-print (dy BODY);
  $r-rflush();
  $r-print (/html);
  return Apache::OK;
  }
  1;

For the record, I am able to cut up a stream nicely using mod_cutup
[1]. This results in something like:

 connection output filter
o bucket 1: TRANSIENT
[htmlfoo]
o bucket 2: TRANSIENT
[headbody]
o bucket 3: TRANSIENT
[ 
!-- sd]
o bucket 4: TRANSIENT
[sd --

[...]

Which at least proves that the snoop filter is working as expected :-)


Anyway, I'll try with the latest mod_perl version as soon as time
allows and post my results later.


[1] http://projects.standblue.net/markive/message.moto?list=apachemodulesID=771


Re: rflush() not working as documented?

2003-08-14 Thread Martin Wickman
Stas Bekman wrote:
Geoffrey Young wrote:
Martin Wickman wrote:
Martin Wickman wrote:

According to docs[1], $r-rflush() should create a new brigade
with data. It does not.

I've seen this also, but was never able to isolate a cause.
 
 rflush() works fine, it's possible that the issue with the streaming
 filter or some other upstream filter that ignores the flush buckets.

I doubt that, no other external filter is in use.

 Are you using the latest mod_perl 2.0? 

Nope. I am using 1.99_07. (Btw, that information _was_ included in my
report, but you trimmed it away:)

This is with:
 Apache/2.0.47 (Debian GNU/Linux) mod_perl/1.99_07-dev Perl/v5.8.0

 It's much appreciated when bug reports are written using the
 following guidelines:
 http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems

Pardon me, but I do believe I supplied enough and accurate information
-- including relevant, trimmed code snippets and excerpts from apache
logs in my report. 

Except from the fact that I did not build mod_perl myself, I can't
really see what I missed to include?

 Martin, please check the mod_perl 2.0 test suite, it has plenty of examples 
 where it used exactly for the reason you've described.

Ok, thanks I'll check it out.

I'm guessing that my mod_perl is too old, I like to stay with the
prebuilt packages (debian) if possible. But if needed, I'll build the
latest version and test it. 

Just thought that someone would know, thats all.


Re: rflush() not working as documented?

2003-08-14 Thread Martin Wickman
On Thu, Aug 07, 2003 at 04:46:51PM -0700, Stas Bekman wrote:
 
 Please try the latest mp2 cvs, I've added a new test t/api/rflush.t,
 it tests rflush explicitly (even though it's already used for
 exactly this purpose in several other tests).

[...]

 does it work for you? 

I tried the latest CVS (modperl-2.0_20030810101543) and my code now
works as expected, ie rflush() splits correctly into brigades. The
t/api/rflush.t works as well btw.

Excellent!

 Is it any different from your code?

Your test-code is essentially the same as my code. I guess my modperl
version had a broken rflush() implementation.


/Thank you!


Re: How to restart the root server from within modperl?

2003-08-14 Thread Martin Langhoff
how can I restart the root httpd server from within modperl?

Use `at` to schedule it a minute in the future -- effectively forking it.

Note that normally apache starts as root and runs as an unprivileged 
user. If this is the case you _can_ achieve it using a suid wrapper or 
sudo, but you'll risk opening a very serious security hole in the 
system. So don't. Instead, run apache as a regular user, on a high port.

If you absolutely need to be in port 80, either setup a simple 
lightweight apache on port 80 as a reverse proxy (see the mod_perl 
guide) or, even simpler, do some port forwarding from port 80 to your 
high port of choice.

regards,



martin




Re: rflush() not working as documented?

2003-08-04 Thread Martin Wickman


Just checking that this did not get lost on the way. Anyone care to
give me a hint?


On Thu, Jul 31, 2003 at 10:17:06PM +0200, Martin Wickman wrote:
 Hello
 
 According to docs[1], $r-rflush() should create a new brigade with
 data. It does not.

 It seems the docs and/or my understanding of this is in error.
 

 This is with:
   Apache/2.0.47 (Debian GNU/Linux) mod_perl/1.99_07-dev Perl/v5.8.0
 
 And I am using the streaming filter api.
 
 [1] 
 http://perl.apache.org/docs/2.0/user/handlers/filters.html#Multiple_Invocations_of_Filter_Handlers
 
 
 Long version below:
 --
 
 I have tried to make my outputfilter clever enough so it can handle
 being called several times, with tags potentially split between
 several brigades.
 
 Now I would like to test this somehow (ie, force mod_perl to call my
 filter several times). I tried using $r-rflush(), but cannot get it
 to work as I and the docs would expect.
 
 I tried creating a ResponseHandler which explicitly breaks some silly
 html data into brigades:
 
   sub handler {
 my $r = shift;
 $r-content_type('text/html');
 $r-log_error (Cutting);
 $r-print (htmlhead title /head); $r-rflush();
 $r-print (bo);$r-rflush();
 $r-print (dy body );  $r-rflush();
 $r-print (/html);
 $r-log_error (Cutting: end);
 return Apache::OK;
   }
 
 And then a simple 'DebugFilter' output filter which just prints each chunk:
 
   sub handler : FilterRequestHandler {
 my $f = shift;
 $f-r-log_error (DebugFilter called);
 $f-print (DebugFilter called\n);
 while ($f-read(my $buffer, 1024)) {
   $f-print(CHUNK:$buffer:CHUNK\n);
 }
 return Apache::OK;
   }
 
 And httpd.conf
 
   Location /test/
 PerlResponseHandler MyApache::Cutter
 PerlOutputFilterHandler MyApache::DebugFilter
   /Location
 
 When I run this, I see that DebugFilter gets called 4 times (3
 rflush's + 1 eos or something). But the strange thing is that only the
 _last_ call contains data. That data is _everything_ nicely
 concatenated and not splitted as I would guess.
 
 Here is actual output:
 
  $ wget --quiet -O - http://localhost/test/
DebugFilter called
DebugFilter called
DebugFilter called
DebugFilter called
CHUNK:htmlhead title /headbody body /html:CHUNK
 
 And the error_log:
 
   [Thu Jul 31 21:52:42 2003] [error] Cutting: start
   [Thu Jul 31 21:52:42 2003] [error] DebugFilter called
   [Thu Jul 31 21:52:42 2003] [error] DebugFilter called
   [Thu Jul 31 21:52:42 2003] [error] DebugFilter called
   [Thu Jul 31 21:52:42 2003] [error] Cutting: end
   [Thu Jul 31 21:52:42 2003] [error] DebugFilter called


Filter brigades with rflush() not working?

2003-07-31 Thread Martin Wickman
Hello

According to [1], $r-rflush() should create a new brigade with
data. It does not. It seems the docs and/or my understanding of this
is in error (probably the latter...).

This is with:
  Apache/2.0.47 (Debian GNU/Linux) mod_perl/1.99_07-dev Perl/v5.8.0

And I am using the streaming filter api.

[1] 
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Multiple_Invocations_of_Filter_Handlers


Long version below:
---

I have tried to make my outputfilter clever enough so it can handle
being called several times, with tags potentially split between
several brigades.

Now I would like to test this somehow (ie, force mod_perl to call my
filter several times). I tried using $r-rflush(), but cannot get it
to work as I and the docs would expect.

I tried creating a ResponseHandler which explicitly breaks some silly
html data into brigades:

  sub handler {
my $r = shift;
$r-content_type('text/html');
$r-log_error (Cutting);
$r-print (htmlhead title /head); $r-rflush();
$r-print (bo);$r-rflush();
$r-print (dy body );  $r-rflush();
$r-print (/html);
$r-log_error (Cutting: end);
return Apache::OK;
  }

And then a simple 'DebugFilter' output filter which just prints each chunk:

  sub handler : FilterRequestHandler {
my $f = shift;
$f-r-log_error (DebugFilter called);
$f-print (DebugFilter called\n);
while ($f-read(my $buffer, 1024)) {
  $f-print(CHUNK:$buffer:CHUNK\n);
}
return Apache::OK;
  }

And httpd.conf

  Location /test/
PerlResponseHandler MyApache::Cutter
PerlOutputFilterHandler MyApache::DebugFilter
  /Location

When I run this, I see that DebugFilter gets called 4 times (3
rflush's + 1 eos or something). But the strange thing is that only the
_last_ call contains data. That data is _everything_ nicely
concatenated and not splitted as I would guess.

Here is actual output:

 $ wget --quiet -O - http://localhost/test/
   DebugFilter called
   DebugFilter called
   DebugFilter called
   DebugFilter called
   CHUNK:htmlhead title /headbody body /html:CHUNK

And the error_log:

  [Thu Jul 31 21:52:42 2003] [error] Cutting: start
  [Thu Jul 31 21:52:42 2003] [error] DebugFilter called
  [Thu Jul 31 21:52:42 2003] [error] DebugFilter called
  [Thu Jul 31 21:52:42 2003] [error] DebugFilter called
  [Thu Jul 31 21:52:42 2003] [error] Cutting: end
  [Thu Jul 31 21:52:42 2003] [error] DebugFilter called


Invalid command 'PerlLoadModule'

2003-07-30 Thread Martin Wickman
Hello

On apache startup I get:

Invalid command 'PerlLoadModule', perhaps mis-spelled or defined by a
module not included in the server configuration

This is with 
 Apache/2.0.46 (Debian GNU/Linux) mod_perl/1.99_07-dev Perl/v5.8.0


Is my mod_perl to old or something? 

Btw, I have followed relevant examples on
http://perl.apache.org/docs/2.0/user/config/custom.html


Re: [QUESTION] Can't read out verified username (auth)

2003-07-21 Thread Martin Wickman
On Mon, Jul 21, 2003 at 01:05:58AM +0200, Fatih Gey wrote:
 
 i was writing my own AuthHandler with modperl v2 (v1.99_09).

[...]

 After having entered user/pass via html-form, this authentification
 does his job well, but on the following request (on same browser)
 $obj-user doesnt seem to return any value.. so this handler tries
 to compare http post data ( which arent present this time) with
 userdata in mysql-table.. resulting in an Auth_Required error.

Well, how do you suppose that the browser should know how and what
credentials to send? 

Unless you (a) create a session-cookie, (b) encode a session-kei into
each url or (c) use the simple but proper Basic Authentication scheme,
there is no way to accomplish this. And from what I gather you are not
doing any of that?



Re: [QUESTION] Can't read out verified username (auth)

2003-07-21 Thread Martin Wickman
On Mon, Jul 21, 2003 at 12:36:55PM +0200, Fatih Gey wrote:
  On Mon, Jul 21, 2003 at 01:05:58AM +0200, Fatih Gey wrote:
   
   i was writing my own AuthHandler with modperl v2 (v1.99_09).
  
  [...]
  
   After having entered user/pass via html-form, this authentification
   does his job well, but on the following request (on same browser)
   $obj-user doesnt seem to return any value.. so this handler tries
   to compare http post data ( which arent present this time) with
   userdata in mysql-table.. resulting in an Auth_Required error.
  
  Well, how do you suppose that the browser should know how and what
  credentials to send? 
  
  Unless you (a) create a session-cookie, (b) encode a session-kei into
  each url or (c) use the simple but proper Basic Authentication scheme,
  there is no way to accomplish this. And from what I gather you are not
  doing any of that?
  

 I supposed the browser to resend always an unique bowser session
 id, which is used by apache to save certain values, like
 $ENV{'REMOTE_USER'} (similiar to a session-cookie with uid and
 serverbased $vars) ..  Isn't this the way Basic Authentication
 scheme works ? ..

Nope. When the browser gets a 401 response from the server, it will
(most likely) pop up a dialog asking the user for name and
password. These credentials gets mangled into an Authorization header
which gets sent with the next request once the user klicks OK in the
dialog. Now, you can perform your authen-code as you like.

Cookies and forms' got nothing to do with it, really.

Read more here: http://www.faqs.org/rfcs/rfc2617.html



Re: Combining authen-handler with mod_auth

2003-07-15 Thread martin
On Mon, 14 Jul 2003 23:26:06 -0500 (CDT), Geoffrey Young wrote:

  Instead of trying to cram multiple perl-script into the same Authen
  phase, which btw could not be done without patching Apache and/or
  mod_perl,
 
 if by perl-script you mean mod_perl handlers, that's not really true.
 currently, mod_perl will run all configured PerlAuthenHandlers until one
 returns an Apache error (401, 500, etc).  when I get back from vacation in a
 few weeks, the first item on my list is changing this so that mod_perl
 behaves exactly like Apache: namely, that the first OK passes control to the
 next phase and terminates the current phase.

Sorry, I was not clear enough. The problem is that I need to run mp2-handlers before 
_and_
after the actual mod_auth (compiled apache binary) module. But apparently mp2 runs 
_all_
its Authen-handlers at the same time, ie it is not possible to split handling in the 
same
phase between mp2 and apache -- something that I must do (afaik?) because of the
ledger-counting.

  By keeping count like this (and assuming it works in a real
  situation), one can device lots of cool ways to add login and password
  policies. Just change relevant part in the Bouncer/Ledger.
 
 I'll take a closer look at this in a few weeks when I'm back full time, but
 right now I think I would have coded it all in the PerlAuthenHandler - I
 think that basic housekeeping like last-auth, etc all are ok things to put
 into that phase, so it makes a certain amount of sense to add your denial
 rules to that phase as well.

Ok. But when I tested it in practice it failed because I need perl-Authen-code to run 
just
before, and just after mod_auth has finished. The only way I could figure out how to do
that was to put Bouncer in the Access phase and Ledger in the FixUp phase. On other 
words
abusing the phases somewhat. 

[stuff added :-) ]

  # Find userinfo in cache. If user is banned, return
  # HTTP_UNAUTHORIZED else let him through to next handler
  PerlAccessHandler MyApache::Bouncer

  # The actual auth module. Patched so it creates an apache
  # request note if user is unauthorized + let request through
  # to next handler (DECLINED) _even tho_ user failed!
  AuthExternal wicauth

  # If apache note contains current user, update cache (nfailures
  # count) and return HTTP_UNAUTHORIZED or return OK
  PerlFixUpHandler MyApache::Ledger

 anyway, I'm essentially offline for the next two weeks, but if you ping me
 after that we can talk more.
 good luck

Thanks!


Abusing apache auth phases [FWD: [Re: Combining authen-handler with mod_auth]]

2003-07-14 Thread Martin Wickman
Any thoughts on this stuff? 

I'd like to try my ideas on the list before going ahead and
implementing it in practice.


- Forwarded message from Martin Wickman [EMAIL PROTECTED] -

From: Martin Wickman [EMAIL PROTECTED]
Subject: Re: Combining authen-handler with mod_auth

On Mon, Jul 07, 2003 at 10:06:59AM -0700, Geoffrey Young wrote:

[...]

I think a lot of interesting password policies could be implemented
if it was possible to run perl-code before and after existing
authentication modules. Is it feasible to add this to the current
mod_perl as a runtime option?

 runtime is not likely to be possible.  I'm considering a patch that
 would make the hook behavior configurable as a compile-time option,

Instead of trying to cram multiple perl-script into the same Authen
phase (which could not be done without patching Apache and/or
mod_perl), I ended up using other phases but Authen. Other phases that
should not really be used for authentication like this and breaks a
few Apache rules.

I specifically had to change mod_auth_ so it returns sets a apache
note and returns DECLINED instead of stopping the whole request with a
HTTP_UNAUTHORIZED. The change is simple and can be applied to any auth
module without much effort.

So, I thought I'd ask the list for opinions regarding this
poor-mans-approach. 


Here is the setup:

Location /secure/
  AuthType Basic
  AuthName Secure Area
  Require valid-user

  # Find userinfo in cache. If user is banned, return
  # HTTP_UNAUTHORIZED else let him through to next handler
  PerlAccessHandler MyApache::Bouncer

  # The actual auth module. Patched so it creates an apache
  # request note if user is unauthorized + let request through
  # to next handler (DECLINED) _even tho_ user failed!
  AuthExternal wicauth

  # If apache note contains current user, update cache (nfailures
  # count) and return HTTP_UNAUTHORIZED or return OK
  PerlFixUpHandler MyApache::Ledger
/Location

Here is my tidied error_log log which shows how it works.

[ User wic with wrong pwd below ]

Bouncer: wic not in cache. Letting through.
AuthExtern wicauth: Failed for user wic.
Ledger: wic not in cache. Adding.

Bouncer: wic in cache: 1  --- nfailures
AuthExtern wicauth: Failed for user wic
Ledger: wic in cache. Updating.

[ ... 10 times or something like that ... ]

Bouncer: wic in cache: 10
AuthExtern wicauth: Failed for user wic.
Ledger: banning wic for 2 hours.

Bouncer: wic in cache: banned
Bouncer: wic is banned!

Bouncer: wic in cache: banned
Bouncer: wic is banned!

[ The user wic is banned and have to wait for 2 hours until Bouncer
will let him through. ]

Bouncer: wic banning time has expired. Letting through.
AuthExtern wicauth: OK accepted for user wic.
Ledger: wic login ok. 


By keeping count like this (and assuming it works in a real
situation), one can device lots of cool ways to add login and password
policies. Just change relevant part in the Bouncer/Ledger.

(Btw, I am using Cache::FileCache to keep track of number of failed
retries.)


- End forwarded message -


Re: Combining authen-handler with mod_auth

2003-07-10 Thread Martin Wickman
On Mon, Jul 07, 2003 at 10:06:59AM -0700, Geoffrey Young wrote:

[...]

I think a lot of interesting password policies could be implemented
if it was possible to run perl-code before and after existing
authentication modules. Is it feasible to add this to the current
mod_perl as a runtime option?
 
 runtime is not likely to be possible.  I'm considering a patch that
 would make the hook behavior configurable as a compile-time option,

Instead of trying to cram multiple perl-script into the same Authen
phase, which btw could not be done without patching Apache and/or
mod_perl, I ended up using other phases but Authen. Other phases that
should not really be used for authentication like this and breaks a
few Apache rules.

I specifically had to change mod_auth_ so it returns sets a apache
note and returns DECLINED instead of stopping the whole request with a
HTTP_UNAUTHORIZED. The change is simple and can be applied to any auth
module without much effort.

So, I thought I'd ask the list for opinions regarding this
poor-mans-approach. 


Here is the setup:

Location /secure/
  AuthType Basic
  AuthName Secure Area
  Require valid-user

  # Find userinfo in cache. If user is banned, return
  # HTTP_UNAUTHORIZED else let him through to next handler
  PerlAccessHandler MyApache::Bouncer

  # The actual auth module. Patched so it creates an apache
  # request note if user is unauthorized + let request through
  # to next handler (DECLINED) _even tho_ user failed!
  AuthExternal wicauth

  # If apache note contains current user, update cache (nfailures
  # count) and return HTTP_UNAUTHORIZED or return OK
  PerlFixUpHandler MyApache::Ledger
/Location

Here is my tidied error_log log which shows how it works.

[ User wic with wrong pwd below ]

Bouncer: wic not in cache. Letting through.
AuthExtern wicauth: Failed for user wic.
Ledger: wic not in cache. Adding.

Bouncer: wic in cache: 1  --- nfailures
AuthExtern wicauth: Failed for user wic
Ledger: wic in cache. Updating.

[ ... 10 times or something like that ... ]

Bouncer: wic in cache: 10
AuthExtern wicauth: Failed for user wic.
Ledger: banning wic for 2 hours.

Bouncer: wic in cache: banned
Bouncer: wic is banned!

Bouncer: wic in cache: banned
Bouncer: wic is banned!

[ The user wic is banned and have to wait for 2 hours until Bouncer
will let him through. ]

Bouncer: wic banning time has expired. Letting through.
AuthExtern wicauth: OK accepted for user wic.
Ledger: wic login ok. 


By keeping count like this (and assuming it works in a real
situation), one can device lots of cool ways to add login and password
policies. Just change relevant part in the Bouncer/Ledger.

(Btw, I am using Cache::FileCache to keep track of number of failed
retries.)


Combining authen-handler with mod_auth

2003-07-05 Thread Martin Wickman
Hello

The short version: 

How can I force my mod_perl Authen-handler to run after mod_auth and
not before it?


The long version:

I have been trying to do some clever things using a combination of
mod_auth with Authen-handlers in mod_perl2 (v1.99.07-1) and apache
2. The actual implementation is not really important, but for
reference see [1].

The handler should count the number of failed retries for each user
and then do take appropriate action (for instance, ban the user or log
info to a file). My approach is to have a perl-handler run right
*after* mod_auth when mod_auth has decided the supplied uid/password
did not match [2]

I have no problems creating a plain authentication handler in
mod_perl, but after trying and trying lots of combinations with
perl-handlers I am struggling to get my handler to run *after*
mod_auth.

Like this:

Location /secure/
#  AuthAuthoritative Off
  AuthUserFile /tmp/htpasswd
  AuthType Basic
  AuthName Secrets
  Require valid-user

  PerlAuthenHandler MyApache::AuthenTest
/Location

No matter how I configure AuthenTest, it will always run right before
mod_auth!

Any ideas how do do this, or for that matter, if there is another
approach that is better.

/Regards
Martin



[2] 
http://groups.google.com/groups?hl=enlr=ie=UTF-8selm=be0i9b%2411n3fm%241%40ID-156202.news.dfncis.de

[1] I realize there may be issues with HTTP_UNAUTHORIZED causing
apache to abort the chain (according to docs anyway), but that can be
handled by patching auth_mod if needed.


Re: Combining authen-handler with mod_auth

2003-07-05 Thread Martin Wickman
On Sat, Jul 05, 2003 at 02:28:09PM -0400, Geoffrey Young wrote:
 
 
 Martin Wickman wrote:
 Hello
 
 The short version: 
 
 How can I force my mod_perl Authen-handler to run after mod_auth and
 not before it?
 
 in Apache 1.3 you could control this with CleanModuleList/AddModule, but 
 those directives don't exist in 2.0.  I think the only way to do it in 2.0 
 is to change modperl_hooks.c and recompile.
 
 try changing this
 
 ap_hook_authen(modperl_authen_handler, NULL, NULL, APR_HOOK_FIRST);
 
 to this
 
 ap_hook_authen(modperl_authen_handler, NULL, NULL, APR_HOOK_LAST);

Thanks!

I guess that may be possible, but somewhat problematic since I like to
stay with the distros apache-version. Btw, I remember seeing something
about APR_HOOK_(LAST|FIRST|...) in the docs on perl.apache.org. Not
implemented yet?

I think a lot of interesting password policies could be implemented if
it was possible to run perl-code before and after existing
authentication modules. Is it feasible to add this to the current
mod_perl as a runtime option?


Can't call method is_initial_req without a package or object reference at .........

2003-06-17 Thread Martin Moss
All,

I'm having some problems with Apache giving me grief, or most probably me
getting my knickers in a complete twist.
I get the following error:-

Can't call method is_initial_req without a package or object reference at
.

It seems to happen when my URL ends like this:-

/somepath/16
but not when it ends like this:-
/somepath/16/



Below is the code which is where the error occurs.
sub handler {
  my $r = My::Apache::Request-instance(shift);

  print STDERR Dumper($r);
  print STDERR \n\n\nBOOOBS\n\n\n\n\n;
  die $r not defined unless $r;
  return OK unless $r-is_initial_req();#ERROR OCCURS HERE
  my $uri = $r-uri;
  my $log = $r-log;


..
}

The handler is simply a multiplexer which based upon a database
configuration adds the relevant method handler to the handlers queue.

The 'instance' routine for My::Apache::Request is inheritted from the
Apache::Request class.

the 'new' routine for My::Apache::Request is as follows:-

sub new
{

  my ($class, $r) = @_;

  my $length=32;

  unless ($r-is_main )
  {
print STDERR Apache::Request is not Main, Getting Main\n;
print STDERR Dumper($r);
$r=$r-main;
print STDERR Main Apache::Request is:-\n;
print STDERR Dumper($r);
print STDERR DECLINING\n;
return DECLINED;
  }
  unless ($r)
  {
print STDERR making a new Request object\n;
$r = Apache-request;
  }



  $r=Apache::Request-new($r);


  my $self = bless {_r = $r}, $class;


  my $t=substr(Digest::MD5::md5_hex(Digest::MD5::md5_hex(time(). {}. rand().
$$)), 0, $length);
  $self-{XX_created_time_XX}=$t;
  my @params=$self-param();
  print STDERR Here's the Parameters for $class\n;
print STDERR Dumper(@params);
  my $lang_id=$self-param('lang_id');
  if ($lang_id)
  {

$lh=My::Maketext-get_handle($class,$lang_id);
  }
  else
  {
   $lh=My::Maketext-get_handle($class,My::Conf::DEFAULT_LANGUAGE_ID);
  }

  print STDERR Creating .ref($self). $t\n;
  #$self-interpret_uri;
  return $self;
}






Re: Can't call method is_initial_req without a package or object reference at .........

2003-06-17 Thread Martin Moss
Ok, that makes sense, thank you:-)
But 'What' should I return, is $r-main the right thing to return?

unless ($r-is_main )
{
  print STDERR Apache::Request is not Main, Getting Main\n;
  print STDERR Dumper($r);
  $r=$r-main;
  print STDERR Main Apache::Request is:-\n;
  print STDERR Dumper($r);
  print STDERR DECLINING\n;
  return DECLINED;
}

 you're not returning an object from your constructor on internal redirects
:)

 HTH

 --Geoff





Re: Can't call method is_initial_req without a package or object reference at .........

2003-06-17 Thread Martin Moss
Thanks Geoffrey.

Marty
- Original Message - 
From: Geoffrey Young [EMAIL PROTECTED]
To: Martin Moss [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, June 17, 2003 4:23 PM
Subject: Re: Can't call method is_initial_req without a package or object
reference at .




 Martin Moss wrote:
  Ok, that makes sense, thank you:-)
  But 'What' should I return, is $r-main the right thing to return?

 I've found that it's pretty rare that you want to mess with main vs
subrequest logic
 yourself.  instead, I would just make the constructor return an object
based on whatever
 mod_perl passes it which is, in turn, whatever request record Apache deems
to be the
 proper one for the current (sub)request.

 so new() should probably just be something like

 sub new {

my ($class, $r) = @_;

$r = Apache::Request-new($r);

my $self = bless {_r = $r}, $class;

$self-init();

return $self;
 }

 if it is important to insure that you only populate object attributes
once, even in the
 case of internal redirects or lookups, you could hang attributes off of
pnotes in the main
 request

 sub init {

my $self = shift;

$t = ubstr(Digest::MD5...);

if ($r-main) {
  $self-{XX_created_time_XX} = $t;
  $self-{_r}-pnotes(XX_created_time_XX = $t)
}
else {
  $t = $self-{_r}-main-pnotes('XX_created_time_XX');
}
...
 }

 or somesuch.  untested, but you get the idea :)

 HTH

 --Geoff





install upgrade for mod_perl+apache 2.046 onto apache 2.044 question

2003-06-08 Thread dan martin
I have apache 2.044 installed on win2k. I want to install the mod_perl which comes with apache included (version 2.046).What do I need to do with the current 2.044 version before installing the new version? Do I uninstall it, stop it, or nothing?Once I install the new version what are the steps to revert back to the old version if I run into problems?This is an active site, so I do not want to figure this out by experimentation, if possible.Thanks for any guidance.dan
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

font width to pixel width in perl - but also offtopic in javascript

2003-06-05 Thread Martin Moss
Hi All,

I'm sure this can't be an issue that hasn't been tackled, but I couldn't
find anything in the archives so:-

I'm trying to find a way in which I can calculate the pixel width of a
string in a given font.
I'm doing this to feed a javascript file, so I am also looking at doing this
in javascript also.

currently all I can find is the php 'imagefontwidth' function. Does anybody
know of an equivalent in perl?
I remember having issues like this in TK, but not sure the solution there
would be appropriate.

I guess this is fuzzily on topic, but if anybody has any off topic
experience I'd be greatful. any approx solutions which can 'guarentee' a
'larger than the minimum space required' would also suffice, e.g. is there
an approximation which I can use based upon the maximum character width
possible for a font etc...

Regards

Marty



Re: font width to pixel width in perl - but also offtopic in javascript

2003-06-05 Thread Martin Moss
Thanks,

I may well have found a solution within javascript, which is then user end
calculated, so more efficient and reliable,

But thanks I'll remember GD for later use:-)

Marty
- Original Message - 
From: Ken Y. Clark [EMAIL PROTECTED]
To: Martin Moss [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 2:55 PM
Subject: Re: font width to pixel width in perl - but also offtopic in
javascript


| On Wed, 4 Jun 2003, Martin Moss wrote:
|
|  Date: Wed, 4 Jun 2003 14:46:52 +0100
|  From: Martin Moss [EMAIL PROTECTED]
|  To: [EMAIL PROTECTED]
|  Subject: font width to pixel width in perl - but also offtopic in
|  javascript
| 
|  Hi All,
| 
|  I'm sure this can't be an issue that hasn't been tackled, but I couldn't
|  find anything in the archives so:-
| 
|  I'm trying to find a way in which I can calculate the pixel width of a
|  string in a given font.
|  I'm doing this to feed a javascript file, so I am also looking at doing
this
|  in javascript also.
| 
|  currently all I can find is the php 'imagefontwidth' function. Does
anybody
|  know of an equivalent in perl?
|  I remember having issues like this in TK, but not sure the solution
there
|  would be appropriate.
| 
|  I guess this is fuzzily on topic, but if anybody has any off topic
|  experience I'd be greatful. any approx solutions which can 'guarentee' a
|  'larger than the minimum space required' would also suffice, e.g. is
there
|  an approximation which I can use based upon the maximum character width
|  possible for a font etc...
| 
|  Regards
| 
|  Marty
|
| Just a wild guess, but perhaps you could load GD.pm and get various
| font widths from there?
|
| ky
|



Re: how to secure perl modules?

2003-05-30 Thread Martin Moss
Hi All,

Just to throw a spanner in the works, a little while ago I came across the
following Article on the Net.

http://www.perl.com/pub/a/2002/10/15/radiator.html
From what I can tell The author of the 'radiator' product claims to have
successfully shipped 'encrypted' code.
I've been pondering how to do this for ages anyay, I realise it's not
completely foolproof, but I'm trying to find a mechanism that would stop
anybody but a perl litterate hacker from getting at my code.

Marty

- Original Message - 
From: Thomas Klausner [EMAIL PROTECTED]
To: modperl [EMAIL PROTECTED]
Sent: Friday, May 30, 2003 8:58 AM
Subject: Re: how to secure perl modules?


 Hi!

 On Thu, May 29, 2003 at 10:27:54AM -0700, iCap wrote:
  i have a collection of perl modules (running under the mod_perl
umbrella)
  and would like to distribute the application to several different
sources
  (clients with open internet web servers).  but i dont want to send it
out
  without at least making it somewhat difficult for some hacker to just
simply
  steal it and load it somewhere else without my consent.  what options do
i
  have (if any) to secure the code so that it can't be 'easily' stolen?
  'easily' being the operative word here, as i realize it wont be 100%
safe no
  matter what i do.
  the ideal would be to perhaps encrypt some of the code, maybe a few of
the
  base configuration modules, maybe even the startup.pl file, others?

 If you want to make it hard to read the code, use an Obfuscator (eg.
 Acme::EyeDrops)

 If want to really secure your code: it's not possible, see this thread on
 perlmonks:
 http://www.perlmonks.org/index.pl?node_id=243011
 or search in the mailinglist archives. This questions was discussed here a
 few times.

 -- 
 #!/usr/bin/perl   http://domm.zsi.at
 for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}




Subclassed Apache::Request Objects and their creation/destruction

2003-04-04 Thread Martin Moss



All,I'm 
looking for some help with understanding how the Apache::Request objectsare 
created and destroyed.I have the following params set in my 
httpd.confKeepAlive OffPerlChildInitHandler 
Bficient::Apache::DBloadWhich as I understand it should mean that an 
apache::Request object iscreated for each request, and is destroyed at the 
end of a request.So if I add 'CREATION and DESTROY' warnings to my 
Apache::Request code tolog when a request is being created and destroyed I 
should see the objectsbeing created and destroyed as they are 
used.This would lead me to believe that when I stop apache, the only 
DESTROYmessages I should see are those belonging to the childInitHandler, 
e.g. Ishould see my database handles being destroyed.I'm just trying 
to get an understanding of what 'should' happen, so that Ican work out If I 
have a problem with my code.I have subclassed Apache::Request and I'm 
seeing my subclassedApache::Request objects being'DESTROYED' under an 
apache stop. AS WELL as after the Request completes,e.g.after the 
request completes I see this:-$VAR1 = bless( 
{ 
'r' = bless( do{\(my $o = 145326836)}, 'Apache::Request' 
) 
}, 'Bficient::Apache::Request' );DESTROYING 
Bficient::Apache::RequestBut when I stop apache I see 
this:-$VAR1 = bless( 
{ 
'r' = 
undef 
}, 'Bficient::Apache::Request' );DESTROYING 
Bficient::Apache::RequestThis doesn't look 'right', but I'm not 
sure.Attached is my Bficient::Apache::Request object, If that 
helps.Any help, or pointers would be greatly appreciated,kind 
regardsMarty
#
#Module to sublass Apache to provide Custom Authorisation mechanisms
#Using the Apache::Session objects for each user.
#

package Bficient::Apache::Request;

use Bficient::Conf;
use lib qw(Bficient::Conf::PERL_LIB_DIR);
use Apache::Constants qw(OK REDIRECT SERVER_ERROR DECLINED FORBIDDEN);
use Apache::Cookie;
use Carp;
use Apache::Reload;
use Apache::Request;
use Bficient::Maketext;
use Data::Dumper;
use base 'Exporter';
use Bficient::DBI;
use Bficient::Apache::DBload qw($bdbh);

use MIME::Base64 qw(encode_base64 decode_base64);

use strict;

@Bficient::Apache::Request::ISA = qw(Apache::Request);
my $lh;


sub new 
{

  my ($class, $r) = @_;

  #unless ($r)
  #{
#print STDERR making a new Request object\n;
#$r = Apache::Request-new;
  #}


  my $self = bless {r = Apache::Request-new($r)}, $class;

  my @params=$self-param();
  print STDERR Here's the Parameters for $class\n;
  print STDERR Dumper(@params);
  my $lang_id=$self-param('lang_id');
  if ($lang_id)
  {
#print STDERR Using language_id of $lang_id\n;
$lh=Bficient::Maketext-get_handle($class,$lang_id);
  }
  else
  {
#print STDERR Using Default language_id of 
Bficient::Conf::DEFAULT_LANGUAGE_ID\nXX\n;
$lh=Bficient::Maketext-get_handle($class,Bficient::Conf::DEFAULT_LANGUAGE_ID);
  }

  #print STDERR Creating .ref($self).\n;
  #$self-interpret_uri;
  return $self;
}

sub DESTROY
{
  my $self=shift;
  print STDERR Dumper($self);
  print STDERR DESTROYING .ref($self).\n;
  #$self-SUPER-DESTROY();
}

sub current_db_id
{
  my $self=shift;
  my $db_id;
  if($self-param('db_id'))
  {
$db_id=$self-param('db_id');
die $self-lh-maketext(Empty database ID string Used in Parameters\n) unless 
$db_id;
  }
  else
  {
my $current_plugin=$self-current_plugin;
#print STDERR Dumper($current_plugin);
my $current_plugin_id=$current_plugin-id;
#print STDERR PluginID='$current_plugin_id'\n;
my 
$database=Bficient::Database-new({_load_default_plugin_database=$current_plugin_id,dbh=$bdbh,lang_id=$self-lang_id});
$db_id=$database-id;
  }

  return $db_id;
}

#sub make_plugin_html
#{
  #my $self=shift;
  #my $tt_href=shift;
#
  #my $html='';
#
  #my $db_id=$self-current_db_id;
  #
  #my $tt_file = Bficient::Conf::FRAMEWORK_TOPBAR_TEMPLATE;
  #$tt_file=~s/\/\//\//;
  #my $template = Template-new(Bficient::Conf::TT2_CONFIG);
  #my @[EMAIL PROTECTED]::Plugin-all({dbh=$bdbh})};
  ##print STDERR Dumper (@plugins);
  #my @non_admin=();
  #foreach my $plugin (@plugins)
  #{
#if ($plugin-Name eq Bficient::Conf::ADMIN_PLUGIN_NAME )
#{
  #$tt_href-{admin_plugin}=$plugin;
#}
#else
#{
  #push @non_admin, $plugin;
#}
  #}
#
  #$tt_href-{r}=$self;
  #$tt_href-[EMAIL PROTECTED];
  #$tt_href-{plugin_count}=scalar(@non_admin);
  #$tt_href-{current_uri}=$self-uri;;
#
  ##print STDERR tt_VARS=\n;
  ##print STDERR Dumper(%tt_vars);
#
  #my $tt_out=$self-process_template($tt_file, $tt_href);
#
  #return $tt_out;
#}

sub user_object
{
  my $self=shift;
  my $session_id=shift;

  my $uh;
  if ($uh)
  {
my $un=$uh-UserName;
#print STDERR HERE IS MY UH for '$un'\n;
#print STDERR Dumper($uh);
print STDERR $lh-maketext(Using Previously Cached user_object for 

checking what values have been set using pnotes/notes

2003-04-04 Thread Martin Moss



All,

Is there a way to work out what values have been 
set using pnotes/notes, So that a cleanup Handler 
can dynamically clear the values, rather than only clear ones 
pre-programmed?

Marty



Apache::AuthTicket lookalike for DBM files

2003-04-04 Thread Martin Langhoff
I am looking for a mod_perl implementation of mod_auth_dbm that takes
cookies instead of HTTP-AUTH Basic. Or perl implementation of
mod_auth_cookie, perhaps (I think mod_auth_cookie does exactly that).
I was sure I would find it in CPAN, and, sure enough, AuthTicket and
others are there, offering far more than I was expecting... But I could
not find one that deals with NDBM files. A search for Apache::Auth* is
not returning likely candidates.
Unless there is a DBI/DBD driver that would allow using NDBM files with
AuthTicket? There doesn't seem to be any :(
I am tempted to add NDBM support to AuthTicket but I am 99.9% certain
that there _has_ to be a module providing the functionality I am
thinking of.
Just to clarify, I don't need the 'ticket' mechanism, just cookie-based
auth against DBM files, with the same options that mod_auth_dbm offers.
Oh, and lazyness is one of my virtues ;)
cheers,



martin
--



Re: Spell Checkers and EMail

2003-03-06 Thread Martin Edenhofer
On Thu, Mar 06, 2003 at 12:23:49PM -0600, Ken Y. Clark wrote:

 [snip]
  A bit off topic, but I have a similar need.  I have a form where HTML is
  entered.  I can easily parse out the text with HTML::Parser, and build a
  list of incorrectly spelled words, open in another window and show the
  words and a list for suggestions or a text field.  I have not figured out
  how best to update the existing form inplace, though.  I fear javascript
  is in my future.
 
 I helped implement a spell-checking system for a customer that was
 pure mod_perl.  In the end, though, a fairly sharp JavaScripter helped
 make my somewhat-kludgy solution fairly elegant by popping up a
 window, calling my stuff to replace misspelled words, then resetting
 the original text with what was left in the pop-up when done checking
 (or the user aborted).  It wasn't that bad, but I'm glad I didn't have
 to write the JavaScript.

There is a nice example for a spell-checking implantation like you wrote.
Maybe it's helpful for somebody: http://demo.otrs.org/ (source: http://cvs.otrs.org/)

 ky

  Martin

--
Old programmers never die. They just branch to a new address.



Can anyone Rcommend a good Apache mailing list

2003-03-05 Thread Martin Moss
All,

I'm having issues with conflicts between using Port and Listen directives
for access via LAN and ssh tunnel (or proxy).
Can anyone recommend a mailing list I can post my problem to?

Kind Regards

Marty

From les Rosbeufs to les Grenuoilles, Standing up to a bully bigger than
you is bravery in motion.  (Me.)



Re: [error] Insecure dependency in unlink while running with -T switch at /usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pm line 106

2003-02-28 Thread Martin Moss
Is Apache::Session::DB_type Faster than Apache::Session::File?

I already use a lot of DB connections and I used Apache::Session::File to
reduce this,

Marty
- Original Message -
From: Cees Hek [EMAIL PROTECTED]
To: Martin Moss [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 5:39 AM
Subject: Re: [error] Insecure dependency in unlink while running with -T
switch at /usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pm line
106


 Quoting Martin Moss [EMAIL PROTECTED]:

  All,
  Can Anybody see what I'm doing wrong here?
 
  I have the following error :-
  [error] Insecure dependency in unlink while running with -T switch at
  /usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pm line 106.

   The problem is not with your code, it is that Apache::Session::File
does
 not work in Taint mode.  Apache::Session::Store::File gets the session ID
from a
 file (which means session_is is tainted), and then uses the tainted
session_id
 to delete a file (hence the unlink error).

   A quick fix for this is for you to untaint the session ID yourself
after
 the session has been unserialized. Put the following two lines right after
you
 tie the session:

 $session{_session_id} =~ /^([a-zA-Z0-9]+)$/;
 $session{_session_id} = $1;

   This probably should be fixed in Apache::Session itself as I am sure
other
 people will run into it.

   By the way, you really shouldn't be using Apache::Session::File
anyway for
 performance reasons. At least use Apache::Session::DB_File which most
likely
 doesn't suffer from this taint problem and will be much quicker.

 Cees



 
  When I run the following subroutine:-
 
  sub delete_session
  {
my $self=shift;
my $session_id=shift;
 
if ($session_id =~ /^(\w\w*)$/)
{
  $session_id = $1; # $data now untainted
}
else
{
  die Bad Tainted data in $session_id;# log this somewhere
}
 
die $self-{lh}-maketext(No Session_id given) unless ($session_id);
 
my $t=time;
my %session;
 
my $Directory = My::Conf::APACHE_SESSIONS_TMPDIR;
my $LockDirectory   = My::Conf::APACHE_SESSIONS_LOCKDIR;
 
$Directory=XX_GR_XX$Directory.XX_GR_XX; #e.g.
  '/path/to/dir/'
$LockDirectory=XX_GR_XX$LockDirectory.XX_GR_XX;  #e.g.
  '/path/to/dir/'
 
if ($Directory =~ /^XX_GR_XX(.*)XX_GR_XX$/)
{
  $Directory = $1; # $data now untainted
}
else
{
  die Bad Tainted data in $Directory;# log this somewhere
}
 
if ($LockDirectory =~ /^XX_GR_XX(.*)XX_GR_XX$/)
{
  $LockDirectory = $1; # $data now untainted
}
else
{
  die Bad Tainted data in $LockDirectory;# log this
somewhere
}
 
#Load an existing session
   eval
{
  tie %session, 'Apache::Session::File',$session_id,
  {
Directory = Bficient::Conf::APACHE_SESSIONS_TMPDIR,
LockDirectory   =
Bficient::Conf::APACHE_SESSIONS_LOCKDIR,
  };
};
if ($@)
{
 die $self-{lh}-maketext(Couldn't Load Apache::Session -
\[_1]\
  For '\[_2]\',$@,$self-UserName);
}
 
print STDERR Just about to unlink\n;
tied(%session)-delete;
return 1;
  }
 
 






Re: [error] Insecure dependency in unlink while running with -Tswitch at /usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pm line106

2003-02-28 Thread Martin Moss
heheheh,

I can't use Apache::DBI.
I have multiple database connections.which are authenticated for different
users. Am wondering whether to bother with the persistance at all, I can
retrieve all the data I need out of the database anyway, I just wanted to
reduce the database lookups. Especially as I could be operating on 100's of
records.

I was using Apache::Session to generate session IDs and allow me to timeout
users etc...

Marty

- Original Message -
From: Perrin Harkins [EMAIL PROTECTED]
To: Martin Moss [EMAIL PROTECTED]
Cc: Cees Hek [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 2:03 PM
Subject: Re: [error] Insecure dependency in unlink while running
with -Tswitch at /usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pm
line106


 On Fri, 2003-02-28 at 08:47, Martin Moss wrote:
  Is Apache::Session::DB_type Faster than Apache::Session::File?

 It depends on your disk, OS, and filesystem.  It stores all the files in
 one directory, which is quite slow on some systems and not a problem on
 others.

  I already use a lot of DB connections and I used Apache::Session::File
to
  reduce this,

 Apache::Session::MySQL (or Oracle, etc.) do not require separate
 database connections.  If you already have a connection (which you would
 if you use Apache::DBI), you just pass it to Apache::Session.

 - Perrin





Re: [error] Insecure dependency in unlink while running with-Tswitch at /usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pmline106

2003-02-28 Thread Martin Moss
Thanks mate,

Will re-examine the drawing board..

Marty
- Original Message -
From: Perrin Harkins [EMAIL PROTECTED]
To: Martin Moss [EMAIL PROTECTED]
Cc: Cees Hek [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 2:52 PM
Subject: Re: [error] Insecure dependency in unlink while running
with-Tswitch at
/usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pmline106


 On Fri, 2003-02-28 at 09:10, Martin Moss wrote:
  I can't use Apache::DBI.
  I have multiple database connections.which are authenticated for
different
  users.

 You're pretty much screwed then on the database front.

  I just wanted to
  reduce the database lookups.

 If you just want to cache data, don't use Apache::Session for that.  Use
 IPC::MM, Cache::Mmap, Cache::FileCache, or MLDBM::Sync.

 - Perrin





[error] Insecure dependency in unlink while running with -T switch at /usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pm line 106

2003-02-27 Thread Martin Moss
All,
Can Anybody see what I'm doing wrong here?

I have the following error :-
[error] Insecure dependency in unlink while running with -T switch at
/usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pm line 106.

When I run the following subroutine:-

sub delete_session
{
  my $self=shift;
  my $session_id=shift;

  if ($session_id =~ /^(\w\w*)$/)
  {
$session_id = $1; # $data now untainted
  }
  else
  {
die Bad Tainted data in $session_id;# log this somewhere
  }

  die $self-{lh}-maketext(No Session_id given) unless ($session_id);

  my $t=time;
  my %session;

  my $Directory = My::Conf::APACHE_SESSIONS_TMPDIR;
  my $LockDirectory   = My::Conf::APACHE_SESSIONS_LOCKDIR;

  $Directory=XX_GR_XX$Directory.XX_GR_XX; #e.g.
'/path/to/dir/'
  $LockDirectory=XX_GR_XX$LockDirectory.XX_GR_XX;  #e.g.
'/path/to/dir/'

  if ($Directory =~ /^XX_GR_XX(.*)XX_GR_XX$/)
  {
$Directory = $1; # $data now untainted
  }
  else
  {
die Bad Tainted data in $Directory;# log this somewhere
  }

  if ($LockDirectory =~ /^XX_GR_XX(.*)XX_GR_XX$/)
  {
$LockDirectory = $1; # $data now untainted
  }
  else
  {
die Bad Tainted data in $LockDirectory;# log this somewhere
  }

  #Load an existing session
 eval
  {
tie %session, 'Apache::Session::File',$session_id,
{
  Directory = Bficient::Conf::APACHE_SESSIONS_TMPDIR,
  LockDirectory   = Bficient::Conf::APACHE_SESSIONS_LOCKDIR,
};
  };
  if ($@)
  {
   die $self-{lh}-maketext(Couldn't Load Apache::Session - \[_1]\
For '\[_2]\',$@,$self-UserName);
  }

  print STDERR Just about to unlink\n;
  tied(%session)-delete;
  return 1;
}



Browser doesn't stop loading a page

2003-02-26 Thread Martin Moss
All,

Not much to go on I know, but has anybody ever had this problem?
When I load one of my webpages the browser never stops loading, e.g. the
page loads ok and I can see and interact with it, but the ie spinning globe
still keeps spinning and the status bar at the bottom of the page still
shows the page is loading something..

The process does seem to run and exit normally in my logs. I'm at a loss as
to what is causing it. This only happens on one specific page on my server.
Any ideas would be appreciated.

Regards

Marty



Re: Browser doesn't stop loading a page

2003-02-26 Thread Martin Moss
Yes I think you're right,

When I click on a link that takes me to the page in question the page simply
stays loading, but it Iclick into the URL Address bar and press enter to
reload the page the page loads fine without continuing to spin the globe.

I've tried making the changes you suggested below, but I think I'm missing
something else as the problem still occurs.
I've just managed to kill my dev machine with out of memory errors so I
think perhaps there is something else I'm doing wrong,

Marty
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, February 26, 2003 2:03 PM
Subject: RE: Browser doesn't stop loading a page



 We had this same problem a while back.  One of our developers pecked at it
 for a couple of weeks off and on, and in our case it turned out to be
 Javascript.  We had some links to the pages that would spin infinitely
that
 looked like:

 a href=javscript:Foo();Link/a

 we changed them to this:

 a href= onclick=javscript:Foo(); return false;Link/a

 and the problems went away.  Just thought I'd toss that out there.  It's
 almost definitely not a mod_perl-related problem.

 -Fran

  -Original Message-
  From: Chris Winters [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, February 26, 2003 8:22 AM
  To: Martin Moss
  Cc: Apache mod_perl
  Subject: Re: Browser doesn't stop loading a page
 
 
  Martin Moss wrote:
   Not much to go on I know, but has anybody ever had this problem?
   When I load one of my webpages the browser never stops
  loading, e.g. the
   page loads ok and I can see and interact with it, but the
  ie spinning globe
   still keeps spinning and the status bar at the bottom of
  the page still
   shows the page is loading something..
  
   The process does seem to run and exit normally in my logs.
  I'm at a loss as
   to what is causing it. This only happens on one specific
  page on my server.
   Any ideas would be appreciated.
 
  IME this means you have an external resource (e.g., image, script,
  etc.) in the page that's not being loaded because the site is
  inaccessible or it's overloaded. Generally nothing to do with
  mod_perl :-)
 
  Chris
 
  --
  Chris Winters ([EMAIL PROTECTED])
  Building enterprise-capable snack solutions since 1988.
 




RE: Help installing mod_perl 1.27 and apache 1.3.27. newbie question.

2003-02-20 Thread Martin Scantland



Charlie,

It just seems like you need to add make in 
your path (sh: make: not found). 

Cheers,
Martin
Martin Scantland IP Services, Internet Engineering, Nortel Networks Phone: 613.765.4052, ESN 395.4052 

  -Original Message-From: Charlie Smith 
  [mailto:[EMAIL PROTECTED]]Sent: Thursday, February 20, 2003 
  9:14 AMTo: [EMAIL PROTECTED]Subject: Help 
  installing mod_perl 1.27 and apache 1.3.27. newbie 
  question.
  I get errors on installing mod_perl/Apache 1.3.27, under the root account 
  when running perl Makefile.PL.
  I'm running perl 5.8 on solaris. gcc 2.95.
  
  
  ### perl Makefile.PLConfigure mod_perl with 
  ../apache_1.3.27/src ? [y]Shall I build httpd in ../apache_1.3.27/src for 
  you? [y]sh: make: not foundAppending mod_perl to 
  src/ConfigurationUsing config file: 
  /www/Apache/src/mod_perl-1.27/src/ConfigurationCreating 
  Makefile+ configured for Solaris 280 platform+ setting C 
  compiler to gcc+ setting C pre-processor to gcc -E+ 
  checking for system header files+ adding selected 
  modules o perl_module uses 
  ConfigStart/End + mod_perl build type: 
  OBJ + setting up mod_perl build 
  environment + id: 
  mod_perl/1.27 + id: Perl/v5.8.0 (solaris) 
  [perl] + adjusting Apache build 
  environment + enabling Perl support for SSI 
  (mod_include)./helpers/TestCompile: make: not found+ using 
  builtin Expat./Configure: make: not found+ checking sizeof 
  various data types./helpers/TestCompile: make: not 
  found./helpers/TestCompile: make: not found./helpers/TestCompile: 
  make: not found./helpers/TestCompile: make: not 
  found./helpers/TestCompile: make: not found./helpers/TestCompile: 
  make: not found./helpers/TestCompile: make: not 
  found./helpers/TestCompile: make: not found./helpers/TestCompile: 
  make: not found+ doing sanity check on compiler and 
  options./helpers/TestCompile: make: not found** A test compilation 
  with your Makefile configuration** failed. The below error output 
  from the compilation** test will give you an idea what is failing. Note 
  that** Apache requires an ANSI C Compiler, such as gcc.
  
   Error Output for sanity check ./helpers/TestCompile: 
  make: not found= End of Error Report =
  
  Aborting!PerlDispatchHandler.disabled (enable with 
  PERL_DISPATCH=1)PerlChildInitHandlerenabledPerlChildExitHandlerenabledPerlPostReadRequestHandler..disabled 
  (enable with PERL_POST_READ_REQUEST=1)PerlTransHandlerdisabled 
  (enable with PERL_TRANS=1)PerlHeaderParserHandler.disabled (enable 
  with PERL_HEADER_PARSER=1)PerlAccessHandler...disabled (enable 
  with PERL_ACCESS=1)PerlAuthenHandler...disabled (enable with 
  PERL_AUTHEN=1)PerlAuthzHandlerdisabled (enable with 
  PERL_AUTHZ=1)PerlTypeHandler.disabled (enable with 
  PERL_TYPE=1)PerlFixupHandlerdisabled (enable with 
  PERL_FIXUP=1)PerlHandler.enabledPerlLogHandler..disabled 
  (enable with PERL_LOG=1)PerlInitHandler.disabled (enable with 
  PERL_INIT=1)PerlCleanupHandler..disabled (enable with 
  PERL_CLEANUP=1)PerlRestartHandler..disabled (enable with 
  PERL_RESTART=1)PerlStackedHandlers.disabled (enable with 
  PERL_STACKED_HANDLERS=1)PerlMethodHandlers..disabled (enable with 
  PERL_METHOD_HANDLERS=1)PerlDirectiveHandlers...disabled (enable with 
  PERL_DIRECTIVE_HANDLERS=1)PerlTableApidisabled (enable 
  with PERL_TABLE_API=1)PerlLogApi..disabled (enable with 
  PERL_LOG_API=1)PerlUriApi..disabled (enable with 
  PERL_URI_API=1)PerlUtilApi.disabled (enable with 
  PERL_UTIL_API=1)PerlFileApi.disabled (enable with 
  PERL_FILE_API=1)PerlConnectionApi...enabledPerlServerApi...enabledPerlSectionsdisabled 
  (enable with PERL_SECTIONS=1)
  
  PerlSSI.disabled (enable with PERL_SSI=1)
  
  Will run tests as User: 'nobody' Group: 'other'Checking CGI.pm 
  VERSION..okChecking for LWP::UserAgent..okChecking for 
  HTML::HeadParserokWriting Makefile for ApacheWriting Makefile for 
  Apache::ConnectionWriting Makefile for Apache::ConstantsWriting 
  Makefile for Apache::FileWriting Makefile for Apache::LeakWriting 
  Makefile for Apache::LogWriting Makefile for 
  Apache::ModuleConfigWriting Makefile for Apache::PerlRunXSWriting 
  Makefile for Apache::ServerWriting Makefile for Apache::SymbolWriting 
  Makefile for Apache::TableWriting Makefile for Apache::URIWriting 
  Makefile for Apache::UtilWriting Makefile for mod_perl#
  --This 
  message may contain confidential information, and is intended only for the use 
  of the individual(s) to whom it is 
  addressed.==


Re: Please wait Handler

2003-02-17 Thread Martin Moss
Thanks for all your help guys,

Will have a think about it,

Marty
- Original Message -
From: Randal L. Schwartz [EMAIL PROTECTED]
To: Perrin Harkins [EMAIL PROTECTED]
Cc: Andrew Ho [EMAIL PROTECTED]; Martin Moss
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, February 16, 2003 7:43 AM
Subject: Re: Please wait Handler


  Perrin == Perrin Harkins [EMAIL PROTECTED] writes:

 Perrin Andrew Ho wrote:
  Make an HTML page which does a form submit to pleasewait.pl.
pleasewait.pl
  just displays an HTML page with an animated please wait image on it,
and
  its headers include the following header:
  Refresh: 1; url=http://www.example.com/getresults.pl?args...

 Perrin That's what Randal does in the article that I posted (although his
 Perrin puts it in a META tag).  It's called client pull, and was
introduced
 Perrin by Netscape at the same time as server push.

 There's a later better example of that (self-cleaning, etc)
 at http://www.stonehenge.com/merlyn/LinuxMag/col39.html.

 I usually don't recycle ideas unless I can put a new slant on it.
 Check out the new slant. :)

 --
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
 See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!





Please wait Handler

2003-02-14 Thread Martin Moss



All,

I was wondering if it is possible to Create a 
Handler that points a user at a page with an animated gif saying something like 
"Please wait", and then when my other handlers have finisheddisplay the 
page results I want from my mod perl handlers.

I guess in a nutshell I'm wondering if there is a 
way to send HTML headers to a browser which tells it to scrap the html it has 
already received and display the new HTML I am passing it.

If this isn't possible, can somebody point me in 
the direction of a 'please wait' mechanism that is possible - Is there 
one?

Kind regards

Marty


Re: mysql password encryption

2003-01-23 Thread Martin Moss
Cheers for all your help,

I realised that I didn't need to worry about decrypting the passwords as I
can use the encrypted password with GRANT. so it solved my problem.
I guess I'll have to group my grants by table rather than permission though.

Regards

Marty
- Original Message -
From: Joe Palladino [EMAIL PROTECTED]
To: Cees Hek [EMAIL PROTECTED]; Martin Moss
[EMAIL PROTECTED]
Cc: Modperl [EMAIL PROTECTED]
Sent: Thursday, January 23, 2003 3:44 PM
Subject: RE: mysql password encryption


 Are the databases under the same database engine instance?  If they are
its
 not a problem as the password is the system table users and you can grant
 access for that user to various databases in the system table database.
To
 use the encrypted password field, use the password('password') function
 supplied by the MySQL library.  It only encrypts your password string, but
 it will let you do a compare of the strings.

 Hope this helps.
 Joe

 -Original Message-
 From: Cees Hek [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 22, 2003 11:29 AM
 To: Martin Moss
 Cc: Modperl
 Subject: Re: mysql password encryption

 Quoting Martin Moss [EMAIL PROTECTED]:

  All,
 
  I wish to let a user use the same password for them to authenticate to a
  multitude of mysql Databases AND to authenticate themselves on my
modperl
  site.
  the problem I have is that I store the password in the database as a
  Password field. However when I wish to use DBI to connect to another
mysql
  database I cannot use the Password stored in the database as it comes
out
  encrypted.  I really don't want to store the unencrypted password
anywhere
  on the system. Is there a way to let DBI/mysql know that the password I
am
  giving them is ALREADY encrypted?

 A feature like that would defeat the purpose of encrypting the password in
 the
 first place.  The point of encrypting the password is so that if someone
 gets
 their hands on the password list, they can not use the encrypted password
to
 access the system.  They would have to crack the passwords first before
 using
 them to access the system.

 By allowing someone to access the system with an already encrypted
password,
 then your passwords might as well not be encrypted at all.

 Since you are using MySQL, have you looked at using the
 mysql_read_default_file
 option to store your password in a config file?  Using a DSN like the
 following
 allows you to keep the username and password in a config file.  Check the
 DBD::mysql perldocs for more info, and the MySQL docs for all the
parameters
 you
 can put in such a file.

 DBI:mysql:test;mysql_read_default_file=/etc/mysql/test.my.conf

 and in /etc/mysql/test.my.conf

 [client]
 user = www
 password = thebigsecretpassword

 Then protect the file:

 chown www /etc/mysql/test.my.conf
 chmod 400 /etc/mysql/test.my.conf

 You still have the password in plain text, but it is readable only by root
 and
 the user that runs the webserver.  You can use this to connect to multiple
 MySQL
 servers as long as the access tokens are the same on all servers.

 Cees
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003






Re: mysql question

2003-01-23 Thread Martin Moss
oooh handbags!

Apologies to the group this is my last email on this topic.

You're all assuming I posted a question about mysql at random.
Please see my previous post which is to do with encryption of mysql
passwords so that the password for Apache Authentication and multiple other
mysql database can be one and the same. I realised I'd attacked it from the
wrong angle, and some people were kind enough to help out, I did not think
it therefore too big a deal to  post a specific question related to the
previous post, which if anybody puts both posts together will make sense.

I would suggest that reading one post out of context, and then assuming I'm
just randomly posting a mysql question 'out of the blue', is a little naive.

Marty


- Original Message -
From: Perrin Harkins [EMAIL PROTECTED]
To: Nick Tonkin [EMAIL PROTECTED]; Martin Moss
[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, January 23, 2003 6:40 PM
Subject: Re: mysql question


 Calm down folks.  Anyone can make a mistake.  This is a diverse list
 with many different levels of Internet experience represented, and one
 off-topic post is not a big enough problem to merit banning people.

 General list etiquette is discussed here:
 http://perl.apache.org/maillist/email-etiquette.html

 Please take care to choose the right place to ask this sort of question
 in the future.

 Thanks,
 Perrin






mysql password encryption

2003-01-22 Thread Martin Moss
All,

I wish to let a user use the same password for them to authenticate to a
multitude of mysql Databases AND to authenticate themselves on my modperl
site.
the problem I have is that I store the password in the database as a
Password field. However when I wish to use DBI to connect to another mysql
database I cannot use the Password stored in the database as it comes out
encrypted.  I really don't want to store the unencrypted password anywhere
on the system. Is there a way to let DBI/mysql know that the password I am
giving them is ALREADY encrypted?

Has anybody else solved a problem like this?

Regards

Marty




modperl ttssh and port forwarding

2002-12-08 Thread Martin Moss
All,

I have a configuration issue, and I was wondering if anybody has had the
same problem?
I have an adsl gateway (192.168.0.1  external IP) and a seperate webserver
(192.168.0.10) on my home network.
I want to allow a user on the internet access to my webserver.
I have once before configured ttssh (Tera term with ssh extension) to talk
to a machine on an internal LAN of another network that was already
configured to allow ssh forwarding, so I know there is a way to do this,
however I can't seem to get it to work, and I suspect the problem is my
Apache webserver running on port 8088 is refusing the connections.

I have my IE browser on the external machine set to use a proxy server of
localhost:999 and my ttssh is set to forward localhost:999 to
192.168.0.10:8088 and I have succesffully logged into my router. When I try
to browse a webpage in my browser I get an error in my apache webservers
access.log logfile:-

192.168.0.1 - - [08/Dec/2002:19:29:28 +] GET /private/ 403
192.168.0.1 - - [08/Dec/2002:19:29:28 +] www.google.com 403

this tells me that my port forwarding has been successful, but my apache is
issuing a 403 forbidden message.

So How do I configure my apache to allow this connection. I have my own
custom authentication mechanism, which covers /private/ but this isn't being
run, apache is refusing the connection before running my access control.

Can anybody provide me with any help or advice?

Kind regards

Marty





Re: modperl ttssh and port forwarding - SOLVED

2002-12-08 Thread Martin Moss
All,

sorry for the trouble, I finally worked out the problem,

I didn't have libproxy.so loaded on my 192.168.0.10 machine and the
directive
ProxyRequests On
set.

Now that I do it works fine,

Regards

Marty
- Original Message -
From: Martin Moss [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, December 08, 2002 5:53 PM
Subject: modperl ttssh and port forwarding


 All,

 I have a configuration issue, and I was wondering if anybody has had the
 same problem?
 I have an adsl gateway (192.168.0.1  external IP) and a seperate
webserver
 (192.168.0.10) on my home network.
 I want to allow a user on the internet access to my webserver.
 I have once before configured ttssh (Tera term with ssh extension) to talk
 to a machine on an internal LAN of another network that was already
 configured to allow ssh forwarding, so I know there is a way to do this,
 however I can't seem to get it to work, and I suspect the problem is my
 Apache webserver running on port 8088 is refusing the connections.

 I have my IE browser on the external machine set to use a proxy server of
 localhost:999 and my ttssh is set to forward localhost:999 to
 192.168.0.10:8088 and I have succesffully logged into my router. When I
try
 to browse a webpage in my browser I get an error in my apache webservers
 access.log logfile:-

 192.168.0.1 - - [08/Dec/2002:19:29:28 +] GET /private/ 403
 192.168.0.1 - - [08/Dec/2002:19:29:28 +] www.google.com 403

 this tells me that my port forwarding has been successful, but my apache
is
 issuing a 403 forbidden message.

 So How do I configure my apache to allow this connection. I have my own
 custom authentication mechanism, which covers /private/ but this isn't
being
 run, apache is refusing the connection before running my access control.

 Can anybody provide me with any help or advice?

 Kind regards

 Marty







Re: libapreq-1.1 Release Candidate 1

2002-11-26 Thread Martin Nilsson
Joe Schaefer wrote:

The apreq developers are planning a maintenance release of
libapreq-1.1.  This version does not include support for
modperl-2, but it does address some outstanding problems in
1.0:


I have made the below patch to make Apache::Request behave like CGI.pm 
when parsing multi-valued http POST data. Without the patch the matching 
of the variable names is case insensitive this results in a multi valued 
list instead of two separate hash entries if the following fragment is 
posted.

input type=hidden name=GOTO value=up
input type=hidden name=goto value=down

Since the keys in perl hashes are case sensitive it makes no sense to 
believe that the above two keys should create a multivalued enty and not 
two entries, one with key 'GOTO' and the other with 'goto'.

To make matters worse actual case used for the resulting multivalued key 
 is only dependent on which field that was parsed first!

	/Martin


--
Martin Nilsson, Civilingenjör M.Sc. CSE
Svenska Butiker AB,
S:t Larsväg 44, 222 70 Lund, Sweden
[EMAIL PROTECTED]
Phone: +46-46-304130
http://www.svenskabutiker.se
--- Request/Request.xs.org  Sun Jan 20 18:27:35 2002
+++ Request/Request.xs  Wed Sep 11 18:11:11 2002
@@ -400,7 +400,7 @@
array_header *arr  = ap_table_elts(req-parms);
table_entry *elts = (table_entry *)arr-elts;
for (i = 0; i  arr-nelts; ++i) {
-   if (elts[i].key  strcaseEQ(elts[i].key, key))
+   if (elts[i].key  strEQ(elts[i].key, key))
XPUSHs(sv_2mortal(newSVpv(elts[i].val,0)));
}
}
@@ -429,7 +429,7 @@
   if (!elts[i].key) continue;
/* simple but inefficient uniqueness check */
for (j = 0; j  i; ++j) { 
-   if (strcaseEQ(elts[i].key, elts[j].key))
+   if (strEQ(elts[i].key, elts[j].key))
break;
}
if ( i == j )



identifying a unique browser session

2002-10-07 Thread Martin Moss

All,

How would I go about identifying if a user logs in from 2 different
browsers?
I Have a Session object, but I want to hold data within that session object
that identifies which browser a user is using. So I can confirm that a user
who provides a session key in their cookie, is checked and that that session
key matches that browser.
The issue is, that an ip address isn't always unique:-(

Any ideas,

Marty




Daft question - preventing the username password box from appearing.

2002-10-01 Thread Martin Moss

All,

How do I change the behaviour of get_basic_auth_passwd()

I do not wish to have the prompt box appear, I want to have a dynamically
produced login form which when submitted carries out the users previous
command (I have an authentication system which 'times out' a user)

the problem I have is that this doesn't work:-

 my $response=timedout($r); #returns a string of html to display
  $r-custom_response(AUTH_REQUIRED,$response);
  return AUTH_REQUIRED;


The problem is this still prompts the user for his username and password,
and only displays the html is the user presses cancel.
How do I ditch the login box completely?

Regards

Marty




Re: Daft question - preventing the username password box from appearing.

2002-10-01 Thread Martin Moss

thanks to everyone,
Geoff's post made me re-examine AuthCookie and I realised I wasn't supposed
to use the get_basic_auth_pw method at all.

Thanks I understand whats going on now.

Cheers

Marty
- Original Message -
From: Lupe Christoph [EMAIL PROTECTED]
To: Martin Moss [EMAIL PROTECTED]
Cc: modperl [EMAIL PROTECTED]
Sent: Tuesday, October 01, 2002 3:06 PM
Subject: Re: Daft question - preventing the username password box from
appearing.


 On Tuesday, 2002-10-01 at 14:16:47 +0100, Martin Moss wrote:

  I do not wish to have the prompt box appear, I want to have a
dynamically
  produced login form which when submitted carries out the users previous
  command (I have an authentication system which 'times out' a user)

 You can't in mod_perl. When you use Basic Authentication, the *browser*
 pops up the prompt box. To change this, you have to ditch Basic Auth
 and implement something else.

 You best start by looking at the various auth packages in Apache and
 those in in Perl (Apache::.*Auth). Then consider doing this in
 Javascript or in HTML.

 HTH,
 Lupe Christoph
 --
 | [EMAIL PROTECTED]   |   http://www.lupe-christoph.de/ |
 | Big Misunderstandings #6398: The Titanic was not supposed to be|
 | unsinkable. The designer had a speech impediment. He said: I have |
 | thith great unthinkable conthept ...  |





Re: problem with $r-push_handlers()

2002-09-17 Thread Martin Moss



I have traced my problem to the following 
subroutine which populates the Hash I use to keep track of mappings of URL's to 
Modules (handlers)to use.
As you will see, at the very end of my parse_file 
subroutine I have two lines commented out. IF I uncomment these lines out, I end 
up overwriting the data in my hash with the clean data I supply. When I do this 
my Apache Multiplexer (the thing which does the 
$r-push_handlers($handler_bf)) works fine and all is fine. However if I 
leave the line commented out - as is here - I get the following 
error:-

[Tue Sep 17 22:41:35 2002] [error] Undefined 
subroutine MyMod::Apache::Test1 called, GEN2 line 2.



So I'm at a loss, any further help you could give 
would be useful,

Marty


Here is a sample file:-
/test1/ = 
MyMod::Apache::Test1/test2/ = 
MyMod::Apache::Test2
Here is a file parsing subroutine I use to read the 
above file and populate a hash, which I export to another 
routine.:-

our (%HANDLERS);

sub _is_tainted{ not eval { 
join("",@_), kill 0; 1; };}

sub parse_file{ my 
$file=shift; print STDERR "Parsing file $file\n"; open 
(FILE,"$file") or die "Cannot open file for reading $file"; while 
(my $line=FILE) { chomp 
$line; if ($line=~/^\#/) 
{ next; 
} else 
{ my 
($keyname,$varname)=split/\=/,$line; print 
STDERR "Initial $keyname = $varname\n"; 
$keyname=~s/^\s*//; 
$varname=~s/^\s*//; 
$keyname=~s/\s*$//; 
$varname=~s/\s*$//; 
$keyname=~s/'//g; 
$varname=~s/'//g; 
$keyname=~s/"//g; 
$varname=~s/"//g;

 
$keyname=~s/^\///; 
$keyname=~s/\/$//; my @tmp=split /\//, 
$keyname; my 
$untainted_keyname; while 
(@tmp) 
{ my $tainted_var=shift 
@tmp; if ($tainted_var 
=~/^([\w-]+)$/) 
{ 
$tainted_var=$1; die 
"$tainted_var is Tainted" if 
(_is_tainted($tainted_var)); 
$untainted_keyname.='/'.$tainted_var; 
die "$untainted_keyname is Tainted" if 
(_is_tainted($untainted_keyname)); 
} 
else 
{ die "Taint Check 
failed for $tainted_var\n"; 
} } 
$untainted_keyname.='/'; if 
($varname=~/^([-:\w]+)$/) 
{ 
$varname=$1; die "$varname is 
Tainted" if (_is_tainted($varname)); 
} else 
{ die "Taint Check failed for 
$varname\n"; 
} 
$HANDLERS{$untainted_keyname}=$varname; print 
STDERR "Added $keyname = $varname\n"; } 
} #$HANDLERS{'/test1/'}='MyMod::Apache::Test1'; 
#$HANDLERS{'/test2/'} = 'MyMod::Apache::Test2'; close 
(FILE);}

  - Original Message - 
  From: 
  Martin Moss 
  To: [EMAIL PROTECTED] 
  Sent: Tuesday, September 17, 2002 2:13 
  AM
  Subject: problem with 
  $r-push_handlers()
  
  
  All,
  
  can anybody provide any help with this 
  problem - and maybe explain why I get the following 
anomoly?
  I've been trying to find the cause of the issue 
  but to no avail:-(
  
  I have MyMod::Apache::Test pre-loaded in my httpd.conf file.
  
  Here is an extract of code:-
  ($handler is defined from a Hash defined within 
  this Code)
  ($handler_bf is defined from a hash exported by a 
  module used in this code. to get to the stage in the code where the following 
  lines commence, I already have read the value from the exported hash and it is 
  held in the variable $handler_bf)
  
  #$r-push_handlers(PerlHandler = 
  $handler);$r-push_handlers(PerlHandler = 
  $handler_bf);
  print STDERR "They match\n ($handler) = ($handler_bf)\n" if ($handler 
  eq $handler_bf);
  
  
  When I run the code I get the following error:-
  
  MyMod::Apache::Multiplex Matched /test/ to MyMod::Apache::Test 
  (MyMod::Apache::Test) for /mod_perl_push_handlers: Not a subroutine name 
  or CODE reference! at /usr/local/lib/perl//MyMod/Apache/Multiplex.pm line 
  101.They match(MyMod::Apache::Test) = 
(MyMod::Apache::Test)
  
  WHEREAS if I use the following code:-
  
  
  #$r-push_handlers(PerlHandler = 
  $handler);$r-push_handlers(PerlHandler = 
  $handler_bf);
  print STDERR "They match\n ($handler) = ($handler_bf)\n" if ($handler 
  eq $handler_bf);
  
  It works and I get this output :-
  
  MyMod::Apache::Multiplex Matched /reconciler/test/ to MyMod::Apache::Test 
  (MyMod::Apache::Test) for /They match(MyMod::Apache::Test) = 
  (MyMod::Apache::Test)
  
  
  So I'm still at a loss. I've tried checking for tainted variables as the 
  handler hash which fails is populated by reading the contents of files, 
  whereas the other is simply defined in the script.
  I'm guessing this is something more subtle like a configuration 
  problem.
  
  I've tried stopping a starting apache after making each change to the 
  script. so each test is run on a fresh server.
  
  Anyway, Answers on a Postcard please:-)
  
  Regards
  
  Marty
  


Re: problem with $r-push_handlers()

2002-09-17 Thread Martin Moss

You are a star!!!

I ammended your syntax slightly
 and did this:-

my $sub_string='sub { '.$handler_bf.'($r) };';
$r-push_handlers(PerlHandler = eval $sub_string);

Otherwise The handler routine of my handler module doesn't get passed the
Apache object as it's first argument.

It seems to work fine. Thank you.

One point to ask, Is this less efficient, as I'm passing an anonynmous
subroutine around rather than a code reference?

I can finally go to bed :-)

Kind regards

Marty



- Original Message -
From: Marcin Kasperski [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 18, 2002 12:55 AM
Subject: Re: problem with $r-push_handlers()


  MyMod::Apache::Multiplex Matched /test/ to MyMod::Apache::Test
  (MyMod::Apache::Test) for /
  mod_perl_push_handlers: Not a subroutine name or CODE reference! at
  /usr/local/lib/perl//MyMod/Apache/Multiplex.pm line 101.
  They match
  (MyMod::Apache::Test) = (MyMod::Apache::Test)

 I have observed similar problem myself. I got the same error when I
 wrote in my startup.pl

 Apache-push_handlers(PerlChildInitHandler,
   \MyApp::Main::on_child_init);

 when I replaced it with

 Apache-push_handlers(PerlChildInitHandler,
   sub { MyApp::Main::on_child_init(); });

 it works as expected.


 --
 ( Marcin Kasperski   | You have the right to peace, fun, and
ctive  )
 ( http://www.mk.w.pl |and enjoyable work.
   )

(---
-)
 ( Nie gub zgosze bdw:
p://www.mk.w.pl/narzedzia/narzedzia_bugewid)





Re: Client capabilities

2002-04-30 Thread Martin Haase-Thomas

HTTP defines an 'Accept' header.

Joel Palmius wrote:

Is there a mod_perl API (or some other standard way) to determine what a 
client web browser is capable of displaying? (images, tables, plugins...)

I am developing a web questionnaire system in mod_perl (1.26) and I'm 
thinking about maybe dividing the display code into different levels 
depending on what the client can handle (no graphics no css for lynx-like 
browsers, stylesheets and images for most browsers, and plugin extensions 
for more advanced browsers). 

Only, I can't figure out how to determine if a client is capable of 
displaing an image, a stylesheets or (as an example) a J2RE 1.4 
java-plugin compatible applet. 

When reading the HTTP_ACCEPT environment variable, both lynx and mozilla 
say they can handle image/png, while in practise lynx cannot display 
that.

  // Joel





-- 
 Constant shallowness leads to evil.
---
Martin Haase-Thomas |Tel.: +49 30 43730-558
Software Development|   [EMAIL PROTECTED]
---






Re: [Q maybe OT] forward

2002-04-29 Thread Martin Haase-Thomas

Hi Perrin,

first of all please excuse my late answer - lots of things in mind to 
care about, as I'm hopefully close to releasing the 0.2 version of the 
serverpage implementation (and besides I urgently need a new job, too).

But thank you for your presice statement, that is exactly what I needed, 
and you helped me a lot. I think that it'll be a consice offer to the 
programmer if I declare 'redirect', 'moved', and 'forward' to be events 
on which enclosing handlers have to react approximately. Which means 
that a 'redirect' should lead to a 301 response, a 'moved' to a 302, and 
a 'forward' to whatever. But these are in fact not of the server page's 
concerns. Would you agree with this approach?

regards
M



Perrin Harkins wrote:

 Martin Haase-Thomas wrote:

 forwarding is a term that i borrowed from the JSP concept - which i'm 
 currently trying to implement in perl.


 JSP forward is directly equivalent to an internal redirect.  It's just 
 an include that doesn't return.  In short, it's a GOTO statement.  
 Thank you Sun.

 - Perrin



-- 
 Constant shallowness leads to evil.
---
Martin Haase-Thomas |Tel.: +49 30 43730-558
Software Development|   [EMAIL PROTECTED]
---






Re: [Q maybe OT] forward

2002-04-28 Thread Martin Haase-Thomas

Hi  Andrew,

thanx for the idea to have a look at Apache::ASP. I took that look 
meanwhile and to me that seems to be an overhead. Maybe I'm naive, 
because it wasn't much more than a glance, but the code copes with 
things a server page *never* has to worry about, things like session 
handling and so on. Apache::ASP looks more like a Java class packet (you 
know: one of these endless stories that java people use to wrap their 
code in - but I don't linme java, as you already may assume...) than a 
perl module. In my understanding a server page is nothing but a document 
that has to be processed by the server, and the result of this process 
is sent to the client. All the other aspects of a web application, like 
sessions or cacheing or th like ar not what the page itself has to care 
about. It either knows the respective values, because the handler passed 
them through to it - or it doesn't. But maybe I'm bragging now - wait a 
few weeks and we'll hopefully both see whether I'm right or not.

Kind regards
Martin


Andrew Ho wrote:

Hello,

MHTforwarding is a term that i borrowed from the JSP concept - which i'm 
MHTcurrently trying to implement in perl.

PHJSP forward is directly equivalent to an internal redirect. It's just 
PHan include that doesn't return.  In short, it's a GOTO statement. Thank 
PHyou Sun.

This concept is supported better in Apache::ASP, where you can just pass
arguments directly to the target page. If you use the internal_redirect()
method, you have to use notes(), pnotes(), globals, or some other
cumbersome method to pass arguments.

Humbly,

Andrew

--
Andrew Ho   http://www.tellme.com/   [EMAIL PROTECTED]
Engineer   [EMAIL PROTECTED]  Voice 650-930-9062
Tellme Networks, Inc.   1-800-555-TELLFax 650-930-9101
--



-- 
 Constant shallowness leads to evil.
---
Martin Haase-Thomas |Tel.: +49 30 43730-558
Software Development|   [EMAIL PROTECTED]
---






[Q maybe OT] forward

2002-04-24 Thread Martin Haase-Thomas

Hi all,

maybe this is going to be a little off topic, but it won't take you much 
time:

I am quite certain that recently I saw a server response code concerning 
forwarding. It may have looked like HTTP_DOCUMENT_FORWARDED or anything 
alike. Silly enough I can't recall where I saw it (or whether I even 
just dreamt it), so my questions are:

1. Has anyone ever seen that ghost before?
2. If I'm right, what is the correct memnonic, what's its code - and: 
where an I find it? perl5.6.1-Apache::Constants::Exports.pm doesn't 
mention it.

Hope it wasn't all just a dream...

thx
M

-- 
   http://www.meome.de
---
Martin Haase-Thomas |Tel.: +49 30 43730-558
meOme AG|Fax.: +49 30 43730-555
Software Development|   [EMAIL PROTECTED]
---





Re: [Q maybe OT] forward

2002-04-24 Thread Martin Haase-Thomas

;) you're right. meanwhile i found out that it seems to have something 
to do with proxies.
forwarding is a term that i borrowed from the JSP concept - which i'm 
currently trying to implement in perl. it means nearly the same as 
redirect, but without telling the client. (as far as i've understood it 
do far. maybe it's just luxury and i'm going to leave it out.)

thank you both for your clues and guesses. i think the best idea will 
lie in informing the programmer that there has been some sort of an 
'event' while processing the page - and leave the uncomfortable decision 
what do to with this 'event' up to him...

... whistling ... :)
M

Per Einar Ellefsen wrote:

 At 07:44 24.04.2002, Martin Haase-Thomas wrote:

 Hi all,

 maybe this is going to be a little off topic, but it won't take you 
 much time:

 I am quite certain that recently I saw a server response code 
 concerning forwarding. It may have looked like 
 HTTP_DOCUMENT_FORWARDED or anything alike. Silly enough I can't 
 recall where I saw it (or whether I even just dreamt it), so my 
 questions are:

 1. Has anyone ever seen that ghost before?
 2. If I'm right, what is the correct memnonic, what's its code - and: 
 where an I find it? perl5.6.1-Apache::Constants::Exports.pm doesn't 
 mention it.

 Hope it wasn't all just a dream...


 Must have been :) Apache::Constants doesn't mention anything about 
 FORWARD, neither does httpd.h. There is DOCUMENT_FOLLOWS, but that's 
 got nothing to do with it.

 What do you mean by forwarding anyway? Like redirect?



-- 
   http://www.meome.de
---
Martin Haase-Thomas |Tel.: +49 30 43730-558
meOme AG|Fax.: +49 30 43730-555
Software Development|   [EMAIL PROTECTED]
---






Trapping browser events

2002-04-11 Thread Martin Harriss

I am using Embperl on an intranet system to perform complex database 
searches and display the results.

My problem is that, depending on the parameters given by the user, some 
searches can take some time - returning thousands of rows, and there is a 
danger that the user will hit the stop button, execute the Back command or 
even close the browser session altogether.  If this happens at the wrong 
time, an oracle connection could have been made, but no SQL sent to it, 
leaving an Oracle process hanging there.

I need to be able to trap these browser events, and I can then call a 
cleanup routine to close any database connections.  I can use the 
Javascript onUnload event, I can't figure how to commmuncate with the Perl 
process.

Any ideas would be welcome.

Martin Harriss
Cambridge UK



Re: Unsubscribe me please [KILL THIS THREAD]

2002-04-10 Thread Martin Haase-Thomas

:) giggle...

Perrin Harkins wrote:

 Please kill this thread.  Some people are not good at dealing with
 mailing lists.  At least this guy was polite.

 - Perrin




-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---






[OT?] What exactly is forwarding?

2002-03-12 Thread Martin Haase-Thomas

Hi all,

I know this is not perfectly the right list for my topic, but before 
subscribing to another for just one question... forgive me if I'm going 
to be boring. Even more, because my question is rather philosophical.

If you consider JSPs, there is a tag called jsp:forward page=... /. 
My question is: how do I have to understand 'forward'? The java 
documentation isn't that verbose, and I can imagine two possible meanings:
1. Forwarding is some sort of an internal redirect to the servlet engine 
which the browser will not be informed of.  From this point of view 
forwarding will be nearly the same as a dynamic include.
2. Forwarding is the same as a redirect.

Maybe a superfluous question for some of you, for me it isn't actually. 
So, if anyone knows an answer - or knows the number of the RFC I'll find 
the information: you're welcome!

Thanx a lot in advance
Martin


-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---





Re: [OT] Thought for the Day

2002-03-12 Thread Martin Haase-Thomas

Should we tell the yellow press in the end?

;)
Martin


Carlos Ramirez wrote:

 I wrote an article about Apache::Motd for UNIX SysAdmin magazine 
 (March 2001 issue). Here's the link: 
 http://www.samag.com/documents/s=1153/sam0103a/

 -Carlos


 Geoffrey Young wrote:

 John Eisenschmidt wrote:

 Sinister, aren't I? G

 For the record I did email directly an explanation of what -o does 
 and to exclude it for clean fortunes, and that it's more fun to 
 make your own. I have quotes from all the Dogma movies that are 
 called within my mod_perl index.html on my website. =)

 Suddenly this thread is on-topic.


 everyone might want to look at Apache::MOTD - it's a similar idea to
 the Unix motd functionality whose implementation is quite clever.

 --Geoff






-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---






Re: [OT?] What exactly is forwarding?

2002-03-12 Thread Martin Haase-Thomas

Thank you both. I thought so: it is one of these typical JSP features - 
but now it works in perl, too ;)

Cheers
Martin


Perrin Harkins wrote:

 Paul Lindner wrote:

 You'll find that $r-internal_redirect() is the mod_perl equivalent.
 Also Apache::ASP containts the Transfer() method which accomplishes
 the same thing.


 Personally, I always thought this was sort of a strange part of JSP.  
 It really shows the page-centric thinking behind it.  Doing a 
 forward is essentially a GOTO statement for JSP.  When I write 
 mod_perl apps, I never feel the need for that sort of thing, with so 
 many better ways to accomplish things (OO, method calls, dispatch 
 tables, template includes).

 - Perrin



-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---






[OT] redirect STDOUT

2002-03-06 Thread Martin Haase-Thomas

Hi all,

instead of committing suicide after having tried and searched for all of 
the day now i'd rather ask you:
does anyone know how to redirect STDOUT into a scalar variable,
so that a 'print anything' will not appear on STDOUT, but only in
my buffer?

desperate
Martin

-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---





Re: How to invoke the save dialog box when clicking in the link, which is generated by PERL script.

2002-03-06 Thread Martin Haase-Thomas

try:
[EMAIL PROTECTED]

M. SubbaReddy wrote:

Hello Gurus,

I am very sorry, if this post is on wrong list.

I have a perl script, which gives dynamic page with search files list.
Pdf and text files are displaying in browser, when clicking in the link of
file.
But, I want to save on to disk, instead displaying in browser.

Like:
On click a hyperlink, we can invoke the add to Favorite window using...
document.write ( a href='javascript:window.external.AddFavorite(url,
description)' ..)

Similarly, how do I invoke the Save Target As dialog box.
Instead I want to save on to disk on click the hyperlink. = a
href=javascript:window.external.SaveAs('http://books.com/js.pdf',filename)

js book/a


Kindly, please give me hint.

Thanks in advance.

Regards,

~ SubbaReddy .M
   Sr. Programmer, Frontlinesoft, Hyderabad
   http://www.frontlinesoft.com
   Ph: 91-40-3392147, 3391683 (O)
   ICQ: 56093095




-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---






[WOT] Opcode/ Safe

2002-03-04 Thread Martin Haase-Thomas

Hi all,

maybe this is really far WOT, but one shouldn't give up hope, as we all 
know...
Does anyone have experience with Opcode and Safe? The thing is that I 
have to create my own secure namespace
for some reasons - and don't know how to do.

What does not work is the following:

#!/usr/bin/perl -w
use Safe;
my $page = new Safe (huhu);
$page-deny qw(:base_io :base_orig :base_thread :filesys_read :sys_db
 :filesys_open :filesys_write :subprocess :ownprocess
 :still_to_be_decided :dangerous);
$page-permit qw(print ref entereval);
$page-deny qw(rand srand);
$page-reval (sysopen '/bla/blub.html' || kill 15, 1906);

Anyone with an idea? btw: funny things will happen if you type 1 instead 
of 1906 ... :)

regards
Martin

-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---





Re: [WOT] Opcode/ Safe

2002-03-04 Thread Martin Haase-Thomas

Ok, forget my post, her's the answer:
#!/usr/bin/perl -w
use Safe;
my $page = new Safe (huhu);
my $opset = Opcode::opset qw(:base_io :base_orig :base_thread 
:filesys_read :sys_db
 :filesys_open :filesys_write :subprocess :ownprocess
 :still_to_be_decided :dangerous);
$page-deny(Opcode::opset_to_ops($opset));
$page-permit qw(print ref );
$page-deny (qw(rand srand));

$page-reval (eval \ print 'huhu' \);
print $@.\n;


Martin Haase-Thomas wrote:

 Hi all,

 maybe this is really far WOT, but one shouldn't give up hope, as we 
 all know...
 Does anyone have experience with Opcode and Safe? The thing is that I 
 have to create my own secure namespace
 for some reasons - and don't know how to do.

 What does not work is the following:

 #!/usr/bin/perl -w
 use Safe;
 my $page = new Safe (huhu);
 $page-deny qw(:base_io :base_orig :base_thread :filesys_read :sys_db
 :filesys_open :filesys_write :subprocess :ownprocess
 :still_to_be_decided :dangerous);
 $page-permit qw(print ref entereval);
 $page-deny qw(rand srand);
 $page-reval (sysopen '/bla/blub.html' || kill 15, 1906);

 Anyone with an idea? btw: funny things will happen if you type 1 
 instead of 1906 ... :)

 regards
 Martin


-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---






Re: Use of uninitialized value. with no line number in error log

2002-02-21 Thread Martin Haase-Thomas

perl sighandlers require the signal as their first argument. so i assume 
that it may not be a good idea to call Carp::cluck(), as any of the Carp 
methods expect strings. try typing as follows:

$SIG{WARN} = sub { Carp::cluck (received signal shift() at 
line.__LINE__) };

martin


Tim Noll wrote:

Stas Bekman wrote:

I know this is a pretty generic question, but if nobody knows a quick
answer, I can get more specific in a later post. Under Apache 1.3.22 /
mod_perl 1.26, even while using $SIG{__WARN__} = \Carp::cluck, I keep
getting Use of uninitialized value. in the Apache error log, with
absolutely no line number or back trace or anything else. Does anybody

know

what might cause this? Thanks.

Where did you set $SIG{__WARN__}? Try in startup.pl as early as possible.


It's set in startup.pl, which is basically a modified version of the example
from perl.apache.org/guide. It works beautifully for every other error I've
come across, which is why this one is so curious. As I mention in my earlier
follow-up to my own post, I eventually traced the problem to an incorrect
driver string in DBI-connect. However, that doesn't explain (to me anyway)
why I wasn't getting more detail in the error log. Perhaps I'll delve into
DBI.pm, unless someone can explain this to me beforehand.

-Tim



-- 
   http://www.meome.de
--
Martin Haase-Thomas |  Tel.: 030 43730-558
meOme AG|  Fax.: 030 43730-555
Software Development|  [EMAIL PROTECTED]
--






Re: Anyone for JavaScript question

2002-02-21 Thread Martin Haase-Thomas

The simple onUnload() construction will not work. You will have to open 
a new browser window on unload displaying the output of your server program.

martin


Medi Montaseri wrote:

I know this is off topic, but I thought someone could use a break...

Given a page called xyz.html, I want to measure the amount of time a
user spent
on this screen (or page) along with other usability metrics. So I
figured I'll use
JavaScript since its running the entire time the page is up.

Then I decided to use onload() and onunload() events to determine start
and end
of the session.

The onload() part is easy. However when onunload() event happens, I need
to
execute a server side program and feed it the data that was collected.

So I figured I setup a dumy form and invoke form.submit() onUnload.
Would this work or is there a better method.

I also thought about a redirect followed by another rediect to where the
user wanted
to go, but that gets too browser dependent and I don't like it when
others hijak my
browser.


--
-
Medi Montaseri   [EMAIL PROTECTED]
Unix Distributed Systems EngineerHTTP://www.CyberShell.com
CyberShell Engineering
-





-- 
   http://www.meome.de
--
Martin Haase-Thomas |  Tel.: 030 43730-558
meOme AG|  Fax.: 030 43730-555
Software Development|  [EMAIL PROTECTED]
--






Re: [OT] Re: Anyone for JavaScript question

2002-02-21 Thread Martin Haase-Thomas

hi nigel,

i never tried aou JSRS before, so i can't judge about it. but posting 
the data to a hidden frame might not work on an unload event. imagine 
the user types in another url  and löeaves the whole
frameset. but now we're running far WOT ... :)

martin


Nigel Hamilton wrote:

Hi Martin,

   You could try posting the form to a hidden frame or you could use
Javascript remote scripting (JSRS) to communicate the onUnload event to
your server.


Nigel


-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---






Re: Use of uninitialized value. with no line number in error log

2002-02-21 Thread Martin Haase-Thomas

you're right, i forgot about those two perl signals.

ashamed
martin

Stas Bekman wrote:

 Martin Haase-Thomas wrote:

 perl sighandlers require the signal as their first argument. so i 
 assume that it may not be a good idea to call Carp::cluck(), as any 
 of the Carp methods expect strings. try typing as follows:

 $SIG{WARN} = sub { Carp::cluck (received signal shift() at 
 line.__LINE__) };


 Sorry Martin, but this is incorrect. There is no signal SIGWARN. 
 $SIG{__WARN__} and $SIG{__DIE__} are special perl signal handlers, 
 which accept the string as the first argument (actually expect a 
 list). This has no effect:

  perl -MCarp -le '$SIG{WARN} = sub { Carp::cluck (received signal 
 shift() at line.__LINE__) }; warn doh, doh'
 dohdoh at -e line 1.

 While this does:

  perl -MCarp -le '$SIG{__WARN__} = sub { Carp::cluck (received signal 
 shift() at line.__LINE__) }; warn doh, doh'
 received signal shift() at line1 at -e line 1
 main::__ANON__('dohdoh at -e line 1.^J') called at -e line 1


 The Carp::cluck trick is correct, unless someone somewhere redefines 
 $SIG{__WARN__}.


 martin


 Tim Noll wrote:

 Stas Bekman wrote:

 I know this is a pretty generic question, but if nobody knows a quick
 answer, I can get more specific in a later post. Under Apache 
 1.3.22 /
 mod_perl 1.26, even while using $SIG{__WARN__} = \Carp::cluck, I 
 keep
 getting Use of uninitialized value. in the Apache error log, with
 absolutely no line number or back trace or anything else. Does 
 anybody

 know

 what might cause this? Thanks.

 Where did you set $SIG{__WARN__}? Try in startup.pl as early as 
 possible.


 It's set in startup.pl, which is basically a modified version of the 
 example
 from perl.apache.org/guide. It works beautifully for every other 
 error I've
 come across, which is why this one is so curious. As I mention in my 
 earlier
 follow-up to my own post, I eventually traced the problem to an 
 incorrect
 driver string in DBI-connect. However, that doesn't explain (to me 
 anyway)
 why I wasn't getting more detail in the error log. Perhaps I'll 
 delve into
 DBI.pm, unless someone can explain this to me beforehand.

 -Tim







-- 
   http://www.meome.de
---
Martin Haase-Thomas |   Tel.: 030 43730-558
meOme AG|   Fax.: 030 43730-555
Software Development|   [EMAIL PROTECTED]
---






[Q] Apache::File-new

2002-02-12 Thread Martin Haase-Thomas

Hi,
I searched in the book, I searched in the FAQs - no I ask u:

Does Apache::File-new start a subrequest? There are some mystical lines 
in my rewrite_log, which might come from there.

Thanx a lot
Martin




Re: [Q] Apache::File-new

2002-02-12 Thread Martin Haase-Thomas
) applying pattern '^(.*)_jsp(.*)$' to uri '/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b5494/subreq]
(1) pass through /67567

Lots to read I know. Hope you'll have the patience.
Many thanx in advance,
best regards
Martin


Geoffrey Young wrote:
[EMAIL PROTECTED]">
  Martin Haase-Thomas wrote:
  
Hi,I searched in the book, I searched in the FAQs - no I ask u:Does Apache::File-new start a subrequest? 

no.  it is merely a layer over Perl's file IO methods (Perl_do_openfrom what I can see).

  There are some mystical linesin my rewrite_log, which might come from there.
  
  that seems strange.  maybe post the lines if they are causing yougrief..HTH--Geoff
  
  
  
  


Re: Apache::DBI

2002-02-12 Thread Martin Haase-Thomas




(doesApache::DBI overload the DBI methods?)
No, it doesn't. It uses Apache and DBI. Did you install the package via the
"Makefile.PL" stanza? Maybe you should just install it another time. On the
other hand, Apache::DBI doesn't export anything. Try calling it with the
package name explicitly.

kind regards
Martin

Marty J. Rogers wrote:
[EMAIL PROTECTED]">
  I had tried that, with the same result. (doesApache::DBI overload the DBI methods?) Fullerror is as follows. Again, any help is _highly_appreciated.Marty[error] Can't locate object method "connect_on_init" via package "Apache::DBI" at /etc/httpd/conf/startup.pl line 28.Compilation failed in require at (eval 14) line 1.Syntax error on line 1276 of /usr/local/apache/conf/httpd.conf:Can't locate object method "connect_on_init" via package "Apache::DBI" at /etc/httpd/conf/startup.pl line 28.Compilation failed in require at (eval 14) line 1.--On Tue, 12 Feb 2002 08:44:12   Martin Haase-Thomas wrote:
  
Marty J. Rogers wrote:

  [snip]From httpd.conf:PerlModule Apache::DBI CGI DBD::mysql \Apache::AuthenDBIPerlRequire /path/to/startup.plAlias /perl/ /path/to/perlPerlModule Apache::RegistryLocation /perlSetHandler perl-scriptPerlHandler Apache::RegistryOptions ExecCGIallow from allPerlSendHeader On/Locationand from startup.pl:use DBI();
  
 use Apache::DBI(); # !! :)
  
use DBD::mysql();...DBI-connect_on_init("DBI:mysql:dbname",   "user","pass",   {Options here}Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com



Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com






Re: Apache::DBI

2002-02-11 Thread Martin Haase-Thomas



Marty J. Rogers wrote:

[snip]
From httpd.conf:

PerlModule Apache::DBI CGI DBD::mysql \
Apache::AuthenDBI
PerlRequire /path/to/startup.pl

Alias /perl/ /path/to/perl
PerlModule Apache::Registry
Location /perl
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
allow from all
PerlSendHeader On
/Location


and from startup.pl:

use DBI();

use Apache::DBI(); # !! :)


use DBD::mysql();
.
.
.
DBI-connect_on_init(DBI:mysql:dbname,
user,pass,
{Options here}


Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at 
http://www.eudoramail.com






QUESTION

2002-02-06 Thread Martin Haase-Thomas




Hi all, 

I hope there'll be someone here to help we with a mod_perl prob, of 
which I thought first it wouldn't be one. I refer to the "Writing Apache 
Modules" book by Stein/MacEachern. 

The prob is quite simple: I have to redirect certain requests under 
certain conditions to another URL (and please believe me: I tried with 
mod_rewrite, this way seems to be more efficient). I'm using Apache 
1.3.22 on Debian Linux 2.4.17. 

These are the lines from my httpd.conf: 

 PerlFreshRestart On 
 PerlTaintCheck On 
 PerlSetEnv SHORTNAMES /etc/apache/shortnames.txt 
 PerlAddVar PROJECT_DOCUMENT_ROOT 
/home/disp05/app/fn/
 PerlRequire /usr/local/sbin/appstart 

 Location / 
 SetHandler perl-script 
 PerlHandler Apache::StaticServer 
 /Location 

The stanza in StaticServer.pm that fails is: 

if ($redirect = $shortnames-get($fname, WAIT, 1)) { 
 if ($redirect !~ /$r-server()-server_hostname/) { 
 $r-content_type('text/html'); 
 $r-header_out ( Location = $redirect ); $log-debug($redirect); 

 return REDIRECT; 
 } 
... 
} 

$shortnames is an Apache::SharedMem segment, containing a vast amount of 
shortnames as keys and the corresponding URLs as values. The funny thing 
is now, that although I do everything exactly as I find it in the book 
on p.125 (content_type, header_out, REDIRECT), I get pure nonsense. 

This is what a libwww-perl client displays when I try to access the address: 

500 (Internal Server Error) unexpected EOF before status line seen 
Client-Date: Wed, 06 Feb 2002 13:40:25 GMT 

This is what I find in access_log: 
192.168.255.75 - - [06/Feb/2002:14:46:24 +0100] "GET /psycho HTTP/1.0" 
200 - "-" "libwww-perl/5.50" 

And this is what stands in error_log: 
[Wed Feb 6 14:46:24 2002] [debug] 
/usr/local/share/perl/5.6.1/Apache/StaticServer.pm(45): [client 
192.168.255.75] 
http://www.domain.de/app/fn/portal_welcome_jsp/52329.html

The error log proves that the second if() matches, as the entry comes 
from my $log-debug(...). 

Has anyone got an idea? I'm close to depression -;) 

Many thanx in advance 
Martin 





Re: Problems with mod_perl and mod_dir (Segmentation fault)

2002-01-04 Thread William T. Martin


I found my problem.  The mod_perl module needed to be compiled with the
same version of gcc as the perl executable.  I recompiled and reinstalled
perl and rebuilt mod_perl and apache.  Everything is working fine now.

-- Bill --


On Thu, Jan 03, 2002 at 02:52:02PM -0500, William T. Martin wrote:
 I am having problems getting mod_dir to work with mod_perl.  When mod_perl
 is loaded, mod_dir does not work.  In particular, I want to specify
 DirectoryIndex index.html in my httpd.conf file to set the default file
 to be accessed.  When mod_perl is loaded, http://somehost/~someuser does
 not work, but http://somehost/~someuser/index.html does.  The error
 message I get is Document contains no data.  The error log shows:
 
 [Thu Jan  3 14:48:19 2002] [notice] child pid 2934 exit signal
 Segmentation Fault (11)
 
 If mod_perl is not loaded, then both forms of the address work and there
 is no Segmentation Fault.
 
 I saw this problem posted somewhere, but do not know if it was answered. 
 
 As an alternative, I tried loading the mod_perl version of AutoIndex
 (http://www.dmi.usherb.ca/laboratoires/documentations-logiciels/Perl/lib/Apache/
 AutoIndex.html), but I get a perl compilation error at runtime. 
 
 Here is my Apache configuration:
 
 # ./httpd -v
 Server version: Apache/1.3.22 (Unix)
 Server built:   Jan  3 2002 13:44:35
 
 # ./httpd -l
 Compiled-in modules:
   http_core.c
   mod_env.c
   mod_log_config.c
   mod_mime.c
   mod_negotiation.c
   mod_status.c
   mod_info.c
   mod_include.c
   mod_autoindex.c
   mod_dir.c
   mod_cgi.c
   mod_asis.c
   mod_imap.c
   mod_actions.c
   mod_userdir.c
   mod_alias.c
   mod_rewrite.c
  mod_access.c
   mod_auth.c
   mod_cern_meta.c
   mod_expires.c
   mod_headers.c
   mod_so.c
   mod_setenvif.c
   mod_ssl.c
   mod_php4.c
   mod_auth_kerb.c
   mod_auth_mysql.c
   mod_perl.c
   mod_autoindex.c
 
 # /usr/local/bin/perl -v
 This is perl, v5.6.1 built for sun4-solaris
 
 I am using mod_perl-1.26
 
 Please help me.
 
 Thank you,
 
 -- Bill --
 
 
 -- 
 ===
 William T. Martin email:  [EMAIL PROTECTED]
 Cornell University/ORIE   Fax:(607) 255-9129
 257 Rhodes Hall   Phone:  (607) 255-9134
 Ithaca, NY 14853  
 Public Key: http://www.orie.cornell.edu/~martin/public_key.html
 ===

-- 
===
William T. Martin   email:  [EMAIL PROTECTED]
Cornell University/ORIE Fax:(607) 255-9129
257 Rhodes Hall Phone:  (607) 255-9134
Ithaca, NY 14853
Public Key: http://www.orie.cornell.edu/~martin/public_key.html
===



Problems with mod_perl and mod_dir (Segmentation fault)

2002-01-03 Thread William T. Martin

I am having problems getting mod_dir to work with mod_perl.  When mod_perl
is loaded, mod_dir does not work.  In particular, I want to specify
DirectoryIndex index.html in my httpd.conf file to set the default file
to be accessed.  When mod_perl is loaded, http://somehost/~someuser does
not work, but http://somehost/~someuser/index.html does.  The error
message I get is Document contains no data.  The error log shows:

[Thu Jan  3 14:48:19 2002] [notice] child pid 2934 exit signal
Segmentation Fault (11)

If mod_perl is not loaded, then both forms of the address work and there
is no Segmentation Fault.

I saw this problem posted somewhere, but do not know if it was answered. 

As an alternative, I tried loading the mod_perl version of AutoIndex
(http://www.dmi.usherb.ca/laboratoires/documentations-logiciels/Perl/lib/Apache/
AutoIndex.html), but I get a perl compilation error at runtime. 

Here is my Apache configuration:

# ./httpd -v
Server version: Apache/1.3.22 (Unix)
Server built:   Jan  3 2002 13:44:35

# ./httpd -l
Compiled-in modules:
  http_core.c
  mod_env.c
  mod_log_config.c
  mod_mime.c
  mod_negotiation.c
  mod_status.c
  mod_info.c
  mod_include.c
  mod_autoindex.c
  mod_dir.c
  mod_cgi.c
  mod_asis.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_rewrite.c
 mod_access.c
  mod_auth.c
  mod_cern_meta.c
  mod_expires.c
  mod_headers.c
  mod_so.c
  mod_setenvif.c
  mod_ssl.c
  mod_php4.c
  mod_auth_kerb.c
  mod_auth_mysql.c
  mod_perl.c
  mod_autoindex.c

# /usr/local/bin/perl -v
This is perl, v5.6.1 built for sun4-solaris

I am using mod_perl-1.26

Please help me.

Thank you,

-- Bill --


-- 
===
William T. Martin   email:  [EMAIL PROTECTED]
Cornell University/ORIE Fax:(607) 255-9129
257 Rhodes Hall Phone:  (607) 255-9134
Ithaca, NY 14853
Public Key: http://www.orie.cornell.edu/~martin/public_key.html
===



asp perl problem

2001-11-12 Thread Julian Martin

Hi
I am new to perl and would like to make a asp page with a script that will
find all files in a given directory and create links to different files in
another directory. The two sets of files are images (thumbnails and big
pics) so I would also like to show the thumbnails on the page and have the
links to the bigger pics.
I already have all the images and do not need a thumbnail generator. I just
want it so that when I add new images thats it. I am not asking for a
complete answer only a pointer towards which functions would best do this
job etc.
Any help you can give would be great.
Ju.


This e-mail, and any attachment, is confidential. If you have received it in
error, please delete it from your system, do not use or disclose the
information in any way, and notify me immediately.



Re: API Design Question

2001-06-30 Thread Martin Redington


On Friday, June 29, 2001, at 07:25 , Shawn Devlin wrote:

 What advantages do I gain by grouping the functions based on 
 functionality? As per my response to Mr. Worrall, one of my concerns 
 with placing each function call into its own module is the amount of 
 memory used by the various .pm files that will be loaded numerous 
 times. I can see that grouping functions based on functionality would 
 reduce the number of .pm files in memory. However, if I go that route, 
 then would I not be better just to leave the API as one file?

A good reason for grouping related functions is not so much 
functionality as common dependencies, and ease of change management.

If everything is in one huge module, then change management become 
tricky, especially with multiple developers. Giving every function its 
own module avoids this, but can make tracking down dependencies tricky 
(and there may be a small memory overhead for each module, but I've 
never looked).

A happy medium is to group together functions that share a dependencies 
on underlying database objects.

For example, if you have a family of library functions that retrieve, 
insert, update, or delete user records, it might make sense to group 
these together in a module. If you need to add a new field to your user 
records, then you change only that module (as well as any changes 
required to your scripts).




Re: Is ProxyPass the best you can do?

2001-06-16 Thread Martin Redington


Squid is the alternative mentioned in the mod_perl_tuning.pod that comes 
with mod_perl.

Alternatively, you could try using mod_rewrite, to direct requests for 
scripts to a different apache instance (e.g. running on a separate port 
or ip). I've never tried this, but it should work.

Squid might be more efficient.

 cheers,
 Martin


On Sunday, June 17, 2001, at 03:43  am, Philip Mak wrote:

 I've been thinking about the ProxyPass technique for coping with
 mod_perl's high memory usage (setup a non-mod_perl httpd that handles 
 all
 requests, but ProxyPasses the mod_perl calls to a mod_perl enabled
 Apache).

 I find that the complexity of this method is more than it should have to
 be. For one thing, ProxyPass only works on a directory. But if you have
 images and scripts in the same directory, this is a problem (and it's
 convenient to be able to have them in the same directory, so that your
 scripts can a href=image.jpg instead of a href=/images/image.jpg
 especially when you have a lot of images in different directories).

 Is there a way to ProxyPass by file extension or something?

 -Philip Mak ([EMAIL PROTECTED])





Re: Is ProxyPass the best you can do?

2001-06-16 Thread Martin Redington

 Can Squid read Apache configuration files? On a new site I'm making
 (www.shoujoai.com), I have directives in httpd.conf like this:

Never used it, I'm afraid ...

 Alternatively, you could try using mod_rewrite, to direct requests for
 scripts to a different apache instance (e.g. running on a separate port
 or ip). I've never tried this, but it should work.

 You can use RewriteRule to make it proxy the request to another 
 Apache? I
 thought you can only alias a URL to a file, or make it send an HTTP
 redirect. How do you make it proxy?

Ah. I was assuming that redirects would be ok (it would be in my 
environment) ...






Re: ssl encryption

2001-06-14 Thread Martin Redington


Not storing the credit card numbers at all would be the best option :-)

If you must, we've usually used crypt for one-way encryption, or 
Crypt::BlowFish for stuff we need to be able to decrypt (look after your 
key!).

On Thursday, June 14, 2001, at 09:54  pm, Tim Gardner wrote:

 When apache is serving a ssl connection, I assume that everything sent 
 back and forth between the server and the client is encrypted. I want 
 an mod_perl script to encrypt/decrypt credit card numbers obtained over 
 the ssl connection for storage in a db on the server. Is there any 
 access to the same routines that apache is using for the encryption or 
 do I have to use some other module.  If I have to use another module, 
 what would be a good choice?

 Thanks,
 Tim




Re: IP based instant throttle?

2001-06-07 Thread Martin Redington


Do you get flooded that frequently that this is an issue?

I've seen DOS, and various buffer overflows etc. in the real world, but 
I've never seen this.

Unless its happening very often, I would have thought that some 
monitoring and a 2am Deny from ip in your httpd.conf would be 
enough ...


On Friday, June 8, 2001, at 01:50  am, Justin wrote:

 Does anyone see the value in a Throttle module that looked at
 the apache parent status block and rejected any request where
 another child was already busy servicing *that same IP* ?
 (note: the real IP is in the header in a backend setup so it
  is not possible to dig it out across children without
  creating another bit of shared memory or using the filesystem?).

 I'm still finding existing throttle modules do not pickup and
 block parallel or fast request streams fast enough .. ok there are
 no massive outages but 10 seconds of delay for everyone because
 all demons are busy servicing the same guy before we can conclude
 we're being flooded is not really great.. modperl driven forums
 (or PHP ones even) can be killed this way since there are so
 many links on one page, all active..

 thanks for any thoughts on this.

 -Justin




Re: Perm Module VM_Monitor (fwd)

2001-06-06 Thread Martin Redington


It can be a real nightmare getting it all compiled and working, 
especially if you're not on Linux, but it is worth it in the end.

I strongly recommend building everything yourself from the ground up, 
wherever possible, especially if you're working in a production 
environment. Vendor-supplied versions are often subtly different from 
the public distributions, and when you do need to recompile for some 
reason (e.g. mod_perl, or Apache modules that don't play nicely with 
your current build) you don't want to have to wait for your vendor to 
pull their finger out.

The perl sources are obtainable from 
http://www.cpan.org/src/stable.tar.gz

There is additional INSTALL documentation for AIX. It looks like you 
will need one of a couple of vendor supplied compilers, or gcc and some 
sweat.

The mod_perl source does contain some stuff about patching the perl 
sources for AIX. This is intended for use by the 'ubiquitous' patch 
program (also written by Larry Wall). Try 'man patch' or 'which patch' 
on your system. If you don't have it, there's a Gnu version you can get. 
If you have trouble getting patch working, just try and patch the 
sources manually :-)

Once you've got your patched version of perl up and running (it may fail 
a few obscure tests ... on Mac OS X, perl 5.6.1 failed on 4 tests), the 
rest *should* be fairly straightforward ...

Good luck!


On Wednesday, June 6, 2001, at 02:54  pm, Stas Bekman wrote:

 This is one of those emails where my address is confused with mod_perl
 list's addresses.

 Ian, if you have questions about mod_perl you should ask them at
 [EMAIL PROTECTED]

 I didn't work with AIX for ages, so neither could be much of help with 
 its
 compiler problems, howerever there are a few folks on the list, who can
 probably help you.

 -- Forwarded message --
 Date: Wed, 6 Jun 2001 14:40:58 +0100
 From: Ian Jones [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Perm Module VM_Monitor

 Help please. Do you have any other documentation. I realise some of the
 problems we incurred are self inflicted.

 We are using Apache under the guise of IBM's websphere products on AIX
 4.3.3 with RS6000 servers. We thought that the VM-Monitor would be very
 useful,
 however our knowledge of Perl and C is extremely limited. One of our 
 Unix
 Admin guys had a go with the following results.

 1) Spend three hours finding out about CPAN modules and picked up one 
 very
 important fact - mod_perl needs to be installed/configured beside the
 webserver
 before any of this could be used.

 2) Spend another couple of hours finding the source code for mod_perl 
 and
 getting it onto a test node.  Now the fun starts

 3)  Need a C compiler to compiler mod_perl and the test node didn't 
 have one
 or
 I had to find/download/installed/compile gcc on to the node

 4) First failure trying to compile mod_perl was that it needed perl 
 (pretty
 obvious with hindsight).  So I moved the C compiler and the mod_perl 
 build
 environment to the unused HUB system (as PSSP comes with perl).

 5) Oops the packaged version is not at a high enough level.  I found an 
 AIX
 perl runtime on the BULL site at the minimum level required and 
 installed
 that.

 6) Now the instructions on mod_perl are invalid for IHS and building a 
 DSO
 so
 it took at bit of time to find a Web Site with the relevant flags 
 listed.

 7) Now the apxs system (api extensions) failled as the file appears to 
 be
 misconfigured - there are no instructions anywhere on what it should be 
 so a
 little bit of trial and error was required to get passed this bit.

  8) Now the C compiler requires a file that doesn't exist and does say 
 what
  should be in it.  So time to move C Compilers - I installed the IBM C
 Compiler
  to see if that gets a further.

  9) Link errors about symbol tables - will this hell ever end.  The 
 compiler
  couldn't find a symbol table in one directory (it was in another one) 
 so a
  symbolic link came about.

  10) Hurray - I finally get a copy of libperl.so created with no errors.
 Time
  to test it with IHS.

  11) Bugger - segmentation fault everytime its called - another search 
 of
 the
  internet shows an article saying that for AIX a patch must be applied 
 to
 the
  perl distribution before mod_perl is created.  It lists all the 
 relevant C
 code
  but gives no indication on how to apply it or in which file.  Yet more
 digging
  makes me think the patch would have to be added to the perl source 
 code and
 the
  recompiled - as I don't have the source its a dead end.

 ANY help would be gratefully appreciated.

 Regards

 Ian Jones



 For more information on Standard Life, visit our website
 http://www.standardlife.com/   The Standard Life Assurance Company, 
 Standard
 Life House, 30 Lothian Road, Edinburgh EH1 2DH, is registered in 
 Scotland
 (No SZ4) and regulated by the Personal Investment Authority.  Tel: 0131 
 225
 2552 - calls may be recorded or monitored.  This confidential e-mail 

Re: advice on Apache::DBI Apache::Session and Apache::AuthCookieDBI intergration

2001-06-03 Thread Martin Redington


On Sunday, June 3, 2001, at 12:28  pm, Clayton Cottingham aka drfrog 
wrote:

 heres what im caught on :
 1.is it best to load Apache::DBI at start up of apache and can i load 
 more than
 one connection type?

yes via PerlModule or a PerlRequire for a startup.pl. My understanding 
is that forked children will get a copy of the pre-loaded module, rather 
than having to load it afresh. This will save you each http child 
loading the module when it is first used.

re connection types, these are usually pulled in with a startup.pl line 
something like

$dbh = Apache::DBI-connect_on_init($driver, $user, $pwd);

AFAIK, Apache::DBI performs connection caching based on a hash of the 
connection parameters,
so next time Apache sees a connect with the same $driver/$user/$pwd 
combo, it will hand out a pre-opened connection, if it has one. If you 
open a connection for a different user/pwd connection, Apache::DBI will 
open a new connection.

To get this other connection pre-opened, just add

$dbh2 = Apache::DBI-connect_on_init($driver2, $user2, $pwd2);

to your startup.pl

I haven't used Apache::Session, so I can't help you with the rest ...

cheers,
  Martin

 2.is it best to login and then set session or set session and then log 
 in
 3. what about 'last session' type storage
 4. if Apache::DBI is on at startup how can i load a specific connection 
 type
 for Sessions?

 i think that's all  the really big questions i have


 system info
 mandrake 7.2 with Apache1.3.12, modperl 1., postgres 7.1
 700Mhz 312 mb ram







Re: dyld problems with Apache 1.3.19 and mod_perl/mod_php on Mac OS X 10.0.03

2001-06-01 Thread Martin Redington


On Friday, June 1, 2001, at 08:33  am, Ged Haywood wrote:


 On Fri, 1 Jun 2001, Martin Redington wrote:

 I'm having some some difficulties with Apache 1.3.19 and
 mod_perl/mod_php. [On Mac OS X]

 Never built on the Mac myself, some people had trouble, looks like 
 you're
 an expert.

I was lucky enough to have built everything before, on Linux, and to 
have the
hints and tips from the stepwise and Mac OS Hints crew ...

  From what I see on the mod_perl List about mod_perl and PHP on
 *other* operating systems they don't always play together too well so 
 you
 perhaps can expect a few teething problems.

I'm pretty sure  that this is OS X specific. The dyld issue with 
multiple definitions is a known issue (see the libtool man page). Apache 
contains a patch which installs error handlers for multiple definitions, 
which ignores them (although its not clear to me if this code actually 
get compiled on OS X, there's a change note for Apache that suggests its 
no longer required).


 Have you been keeping an eye on the mod_perl lists lately at all?

 The reason I ask is that there have been some recent discussions about
 mod_perl on MacOS X and if you've not seen them it might be worth your
 while browsing.  Only in the last few weeks, maybe a couple of months.

I've searched the mod_perl (and other) archive(s) pretty extensively. Try
google with 'Mac OS X dyld multiple definitions to see some posts. Lots 
of people
seem to have hit the dyld problem with one thing or another (python is 
another one),
but no-one's posted any good info on fixes for it.


 Sorry if this isn't too much help.  Maybe you'll get something more
 concrete when people start to disagree with me. :)


I hope so. Right now it seems like no-one is running 
apache/mod_perl/mod_php with Apache::DBI
(if you are, and can get it to work, *please* let me know how you did 
it) ...




dyld problems with Apache 1.3.19 and mod_perl/mod_php on Mac OS X 10.0.03

2001-05-31 Thread Martin Redington


I'm having some some difficulties with Apache 1.3.19 and 
mod_perl/mod_php. Everything builds fine, but I get dyld multiple 
definition errors in some circumstances. I believe this is connected to 
the OX X dyld's insistence on freaking out with multiple definitions (so 
non Mac OS X users might like to stop here) but I'm not sure what the 
fix is. I've spent quite a long time on this, and am getting quite 
desperate. Any pointers would be very helpful.

I'm used to using persistent database connections under mod_perl and 
Apache, via the Apache::DBI modules, and Tim Bunce's excellent DBD 
modules, on Linux.

I also like to build everything myself. So, I downloaded and installed 
Perl 5.6.1, Apache 1.3.19, mod_perl 1.25, mysql 3.23.36, the 
Msql-Mysql-modules 1.2216, DBI 1.15, Apache::DBI 0.88 and php 4.05.

After some fiddling, and with some help from Mac OS X Hints and Stepwise 
(Thanks especially to the macosx-perl mailing list, Scott Anguish at 
Stepwise, and Merlin Tishauser [EMAIL PROTECTED]), I got everything to 
build. I also got persistent database connections to a mysql database.

When I added mod_php to the build, via apxs, my apache build started 
dying on startup, with the following error message:

dyld: /usr/local/apache1.3.19/bin/httpd multiple definitions of symbol 
__dig_vec
/usr/local/apache1.3.19/libexec/libphp4.so definition of __dig_vec
/Library/Perl/site_perl/5.6.1/darwin/auto/DBD/mysql/mysql.bundle 
definition of __dig_vec
/usr/local/apache/bin/apachectl start: httpd could not be started

I tracked the error down to a startup script that I run via a 
PerlRequire directive (see the mod_perl docs), to open an initial 
database handle, and load various perl Modules. Commenting out the 
PerlRequire stopped the error, but when I requested my test_database.pl 
script (which runs a simple select on the database), from a mod_perl 
directory, the browser hung, and similar dyld errors appeared in the 
error log. Strangely, a copy of the script that I keep in in a non 
mod_perl cgi-bin directory runs with no problem. Within the script, the 
errors originate with the line use DBD::MySQL, or at an open 
connection statement, which is effectively the same thing.

I think what is happening is that the __dig_vec symbol being loaded from 
the DBD::MySQL bundle is conflicting with the same symbol in mod_php. I 
looked in the Apache 1.3.19 source, and can see handlers for multiple 
definition in os/unix/os.c, but I guess that the DBD::MySQL module is 
being loaded by code in perl or mod_perl.

I guess my question is, is there an easy way to fix this conflict, or do 
perl and/or mod_perl need to be patched with similar dyld error handlers 
to the ones in Apache (see os/unix/os.c)?

My config info is as follows:

Perl:

 config_args='-ds -Dmksymlinks -Adefine:prefix=/usr/local 
-Dccflags=-g -pipe -Dfirstmakefile=GNUmakefile 
-Adefine:privlib=/Library/Perl/5.6.1 
-Adefine:sitelib=/Library/Perl/site_perl/5.6.1 
-Adefine:vendorlib=/Network/Library/Perl/5.6.1 
-Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/local/man/man3 
-Uinstallusrbinperl'

Apache:

./configure \
--prefix=/usr/local/apache1.3.19 \
--with-layout=Apache \
--enable-module=all \
--enable-shared=max \

mod_perl: built via apxs, with EVERYTHING=1

PHP (patched as advised by Merlin Tishauser):

./configure \
   --with-xml \
   --with-zlib \
   --with-apxs=/usr/local/apache/bin/apxs \
   --with-mysql=/usr/local/mysql \
   --disable-pear \
   --enable-track-vars \

==
===



Re: Using modperl as an 'adaptor' front end to an app server.

2001-02-02 Thread Martin Wood

On Fri, Feb 02, 2001 at 06:44:07PM +0800, Gunther Birznieks wrote:
 Yes, we do this for several clients using SOAP as an RPC transport to Java 
 middleware.

Out of interest, are all these clients using different SOAP implementations on 
different platforms? 

We are designing a system that accepts XML messages from disparate sources and routes 
them to their destination based on content and are thinking of using SOAP to formalise 
the encoding method (transportation is via HTTP), yet I keep reading about issues with 
interoperability between different SOAP implementations which defeats the purpose as 
far as I'm concerened.

Any experiences in this area appreciated. (Off-list?)

Regards,

Martin



Anyone using virtual server for mod_perl hosts?

2001-01-30 Thread Martin Langhoff

hi,

due to some fairly complex issues (money, or lack thereof), I am
considering turning a mod_perl server from co-location into a 'virtual
server' service, like Verio offers. 

Far from asking if it is a good solution (I know it is not) I'd like to
know if its feasible. I have been managing remote co-located servers for
quite a while, so I am already used to the impotence of not being able
to kick the box when it misbehaves. In fact, last time I got really
angry at a box I got a my fist cut, hitting it. So remote boxen might
turn out to be healthier for my temper ;)

Is anyone using a 'virtual server' succesfully? Or have a horror story?
Know of companies other than verio? 

Oh! and before anyone points it out, yes, it low -- low -- low traffic.
The current server never gets more than 0.5 load average.




Martin



Repost: Anyone using virtual server for mod_perl hosts?

2001-01-30 Thread Martin Langhoff


As many people understood I mean some kind of virtual host service, I
would like to restate my question.

There are companies (Verio at least) offering a 'virtual machine'
running a virtualized OS. Verio is offering NetBSD and Solaris. They
have a seriouly large iron where many virtual machines run, each virtual
machine gets a share of CPU, HD and RAM resources, an at least an IP
address. 

In there is a full OS, and you get to be root for about $150 a month.
It's a cheap alternative to co-location, a middle ground between a good
virtual hosting service and owning a box. You can run your own MTA,
compile whatever the hell you want, etc, although they offer a bunch of
services out-of-the-box and have a lot of useful --if annoying-- cron
jobs rotating your logs, monitoring the temperature of your daemons,
feeding the dog and whatnot. 

Of course, you get to share resources with a bunch of other customers.
It seems a great environment to set up a low traffic / highly customized
server, like apache+mod_perl. Now, I know and understand the services
they offer, but I have never actually used one with mod_perl. 

Now, has anyone tried this services? Do I have to worry about anything?
Why didn't Stas list them in his article? -- they don't appear in the
Guide either -- Do they have a fundamental or practical flaw I can't
see? 



Martin



Re: Repost: Anyone using virtual server for mod_perl hosts?

2001-01-30 Thread Martin Langhoff

Blue Lang wrote:
 
 Woah.. I had never heard of this. Have you actually been on a box? I'm
 calling them to see if a demo is available.
 

 I have been on such a box, once. Unluckily, I wasn't root, so I could
not do much there. Of course, if someone is eating up resources, I'll
have to fight them... spawn a few mod_perl processes in core, and I
guess every other virtual machine will be running from swap ;)


m



Re: Making PHP and mod_perl live together in Apache 1.3.14.

2001-01-27 Thread Martin Langhoff

Mr Wells,

I have succesfully built them together following this procedure. I am
also including mysql and imap support in PHP. Be aware that many lines
that should be a 'one-liner' have been broken by my mailer. 

untar apache 1.3.12, mod_perl 1.24, php 4.0.3 and c-client (from uw)

# build imap client code
cd imap-2000.RELEASE-CANDIDATE.7/
make lnp

# make some symlinks required by PHP
ln -s /usr/src/downloaded/imap-2000.RELEASE-CANDIDATE.7/ lib
ln -s /usr/src/downloaded/imap-2000.RELEASE-CANDIDATE.7/ include

# prep Apache [PHP needs it]
cd ../apache_1.3.12
./configure

# prep PHP 
# To avoid conflicts with mod_perl's DBI, we need to tell 
# it to use the system's mysql client, usually found at /usr 
# you can find it with `locate mysql.h`
cd ../php-4.0.3
./configure --with-apache=../apache_1.3.12 --enable-track-vars
--with-imap=/usr/src/downloaded/imap-2000.RELEASE-CANDIDATE.7/
--with-mysql=/usr
make ; make install

# prep mod_perl segn INSTALL.apaci
cd ../mod_perl-1.24
perl Makefile.PL EVERYTHING=1 PERL_TRACE=1
APACHE_SRC=../apache_1.3.12/src DO_HTTPD=1 PREP_HTTPD PERL_MARK_WHERE=1
USE_APACI=1
make
make install

# with this conf, the resulting apache is a STATICALLY LINKED APACHE
cd ../apache_1.3.12
./configure --prefix=/usr/local/apache.heavy
--activate-module=src/modules/perl/libperl.a --with-layout=Apache
--enable-module=all --activate-module=src/modules/php4/libphp4.a
make 
make install

# to make it shared, use --enable-shared=max 



[OT] All of Perldocs to HTML files

2001-01-16 Thread Martin Langhoff

Hi,

I know this is is wy OT. Kick me privately, please. I am looking
for a way to dump all of the available perldocs into an organized HTML
structure. Activestate people are doing it in their standard distro --
but I couldn't find how. They even get cross-module links ("See Also")
just fine. 

Is there a know script for that? A canonical way to do it?



Martin



[OT] Problems preparing a module for CPAN

2000-12-28 Thread Martin Langhoff

hi,

once again, steering off-topic ... :(

I've got a nice little module (Mail::Vmailmgr) I am trying to bundle in
the standard CPAN fashion, so that it has a proper Makefile.PL, etc.

I am following my Perl Cookbook, recipe 12.8 ... steps taken:

% h2xs -AX -n Mail::Vmailmgr
% cd Mail/
% vi Vmailmgr.pm 

and wrote all of my module there, picking what h2xs had prepared.
Now when I follow the next step, it fails:

% make dist
make: *** No rule to make target `dist'.  Stop.

And neither `man perlmod`, `man perlmodlib`, CPAN or O'Reilly's errata
page has any hint ... 

Now many fellow hackers here seem to be releasing successfully to
CPAN... so ... what's the secret? What am I missing? (a neuron or two,
maybe?)


martin



[OT]Problems with `use locale`

2000-12-20 Thread martin langhoff

hi,

sorry for being so OT. The problem is showing up in a mod_perl app, but
it's certainly not related at all. 

Dealing with Spanish as we are, we always have problems with regexp,
uc() and lc(). I've found that on my dev box, just adding `use locale`
at least uc() and lc() would work allright (meaning ñ got changed into Ñ
properly).

Now I've built a customer's machine with a newer distro and my uc() is
broken where it was working. 

The devbox has RHLinux 6.1 and perl 5.005_03-6
The customer's box has RHLinux 6.2 and perl 5.005_03-10

And the output of `locale` and `locale -a` is identical on both boxes.
Unluckily I'm not about to downgrade the box to 6.1 ... it's a complex
Compaq beast that doesn't like 6.1 ...

Have you seen anything similar? have any pointers? flames? rants? 

Thanks!



martin



Re: Email (mod_perl) Apache module?

2000-12-15 Thread martin langhoff

Jeremy Howard wrote:
 IMHO, the best open source WebMail servers are PHP based

true, I am using and patching TWIG quite a lot, and that made me see how
messy PHP gets when dealing with libraries and things. It's not nice to
see a large app written in PHP... at least not this one.

I have this dangling idea of building a TWIG lookalike (in Perl), with
a 'plug-in'/'module' structure, so I may write the email client, and
others fill with their desired modules. Anyway, it's a seriuos
undertaking, but it's in my plans to rip as much code and design choices
from stable OS webmails as possible.

It's  just a way to soak up all my holidays in perl code ... 




martin



Re: Email (mod_perl) Apache module?

2000-12-15 Thread martin langhoff

brian moseley wrote:

 (speaking as the author of a proprietary mod_perl
 webmail...)
 
 DO IT!!

my fear is that writing it as a mod_perl app, it'd be terribly niche,
and we wouldn't get it rolling. I'd rather write a bunch of modules,
that can be called from a CGI or a templating system. 

Then those modules can be reused on other apps.

Plus, we should be writing that is pure-CGI compatible -- y'know, we
won't be needing any actual mod_perl hooks, and CGI-compat means is more
usable under other configs, and keeps you honest.



martin



Re: Email (mod_perl) Apache module?

2000-12-15 Thread martin langhoff

Perrin Harkins wrote:

 Is there a reason you don't want to just hack on WING?

I've seen TWIG and its *very* clever, if ugly. It'll let you
authenticate against a lot of things. Use IMAP or POP. Use News. Use
mysql, Postgres, MySQL, or none. Use cookies or encoded links for state.
It's *very* flexible, and I've come to like that a lot. 

That's why I'd like to base most of my design choices on it. 



martin



Mem Sizing tool [was: splitting the code sets across more than one mod_perl server]

2000-12-13 Thread martin langhoff


hi,

[now to the list, also]

maybe all of these mathematical formulae can be made into a
smallish perl script that grabs this info from `top ax`. I am not sure
that top is the proper source of memory usage across platforms.

In fact, as I am not a unix old-timer, I should be asking
*where* to get that info reliably from. With that info, I could prepare
such a script ... it'd be quite useful, I'm building a few servers with
very low memory.

Stas wrote (privately) that there is no consistent cross platform
command that will reliably report memory usage for a given set of
processes. He also mentioned Apache::GTop, but I was thinking about an
external script. A script I can call from the command line and will
evaluate my three HTTPDs and their children, and report global and
detailed memory usage. 

It should be a general purpose tool, not something mod_perl-dependant
at all. It might be system dependant, of course. It could be checking
what OS it's on and call the proper command accordingly.



martin



Re: Smart installing (Re: mod_perl advocacy project resurrection)

2000-12-07 Thread martin langhoff

"Aaron E. Ross" wrote:

database abstraction and connection pooling = DBI
session management  = Apache::Session
load balancing  = mod_backhand??
data relational mapping = Tangram or Alzabo
templates or whatever you want to call them = HTML::Embperl/Mason/TemplateToolkit
ide = pick an editor with a few hooks to call make, install and restart


I'd say that load balancing is too involved an issue to make it
into a
package, I'd leave it aside, as anyone actually needing it will be
certainly building his apaches manually.

And I would also leave the IDE aside, (although I think I have a
great
candidate[1]). IDEs are very personal things, and users are sometimes
very attached to theirs ... so much that merely installing an IDE is
sometimes an offence.

[1] Having grown up in a cushioned, fancy VB 3.0 IDE, I still
find both
vi, emacs and textmode debug too harsh for me. So I've been toying with
the early releases of Komodo
(http://www.ActiveState.com/Products/Komodo.html) and I actually like it
although its far from finished. Has anyone used/tested it? 



martin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




  1   2   >