Re: Session-handling and multiple browser windows

2000-06-12 Thread shane

 1.  Stop the user from ever having the site open in more than one
 window.

Pretty inconvenient, no?  Unless this is something that's supposed to
be really tight security I would opt against this.  (I'm sure it's a
bear to implement too.)

 2.  Somehow allocate the new window it's own session.

Same as 1

 3.  Don't store any page-specific state in the session hash; limit the
 information that the session hash contains to state that applies to the
 entire session.

This seems to be the "right" solution.  Here's how I usually deal with
this:

Three classes of data:
1) Long Term
2) Session Term
3) Page Term

1:
Stored in database that is refered to by keys in the hash from the
session data once a person has "logged" in.
2:
Stored in session space, this is only a pointer to data that's used on
almost EVERY page.  Store this in a fast database program, mysql,
where as long term data is stored in Oracle, or some other "true RDBS"
(read slow :-)
3:
This data is ephemeral, therefore it seems awkward to store it in your
database, and awkward to store it in your session (Basically same as
storing in database, but it has to be looked up every go round, so you
need to be carefull to keep this data stack small).  So what I usually
do is "store" it in POSTs, or GETs, Get's being better because they're
more likely to "transfer" to the next page when a user clicks on open
in link in a new browser window or something like that.

But there are no hard and fast rules on this obviously.  The one key
thing is to keep your session really small..., the reason for this is
that you can't do incremental updates of session data, it has to
update the entire hash.  Also it has to be read everytime from the
DB... this is a pretty slow process.  So what I try to emphasize is
keep the session data down to stuff that's only used on every page.
(The 80% rule I suppose)  Of course if your only planning on having a
site that is used by a few hundred/thousand people total, then do
whatever you want :), but if you want it to be scalable, you need to
think long and hard about how you're using your sessions.

Shane.

 
 Option three (removing all page-specific state from the session hash)
 seems like the right thing to do.  I'd like to avoid it if possible,
 however, because it means passing more information through URLs and having
 to secure it.  Have other people encountered this problem, and are there
 smart ways to do option 1 or option 2?
 
 (If it matters, I'm using HTML::Mason as my templating engine.)
 
   -- Dylan
 



Re: mod_perl, Perl 5.6 .0 DBI

2000-06-12 Thread jake buchholz

On Mon, Jun 12, 2000 at 09:48:25AM +0200, Rolf Stoll wrote:
 I have Problems with mod-perl V. 1.24 working together with perl 5.6.0
 and a script that use DBI.
 I use Apache 1.3.12 with Linux.
 As a CGI without mod_perl the script works fine (it is no Problem of my
 database configuration).
 
 With mod_perl I get a:   [notice] child pid 652 exit signal Segmentation
 fault (11)
 as soon as i try to make a $dbh = DBI-connect(...);
 What kind of problem is this?
 Does mod_perl not cooperate with Perl 5.6.0 or is this a Problem of the
 DBI-Module?

I recently ran into this same (or similar problem).  Do you have PHP4
in the kernel or loaded as a module?  As it turns out, PHP4 has its own
mysql client code, and if you specify just --with-mysql when building
it, it'll use it's code, and not try to load libmysqlclient.so.  However,
when DBI loads DBD::mysql, and then tries to use libmysqlclient functions,
you get the segfault.  For me, I solved the problem by configuring PHP4
with --with-mysql=/usr/local, which forced it to use the libmysqlclient
in /usr/local/lib/mysql, and things were much happier.

-- 
Jake Buchholz, Senior Systems Administrator :   /~\
ExecPC (a Voyager.net company, NASDAQ: VOYN):ASCII  \ /  Against
Voyager.net Hosting Solutions Lead RD Engineer :   Ribbon   X   HTML
GnuPG (PGP5/6) and PGP 2.6.2 pub keys available : Campaign  / \  Mail



oracle error log

2000-06-12 Thread Jesús Lasso Sánchez



hi everybody,

 I've configured apache 1.3.9 + 
mod_perl 1.21, and i installed the Apache::DBI module to access an oracle 
database. Apache works and i can access to the database and i can do 
querys, but in the error log file it produces this error messages:


---
[Mon Jun 12 17:43:35 2000] [notice] caught SIGTERM, 
shutting downORACLE_HOME environment variable not set!ORACLE_HOME 
environment variable not set![Mon Jun 12 17:43:36 2000] [notice] 
Apache/1.3.9 configured -- resuming normal operationsORACLE_HOME environment 
variable not set!ORACLE_HOME environment variable not set!ORACLE_HOME 
environment variable not set!ORACLE_HOME environment variable not 
set!ORACLE_HOME environment variable not set!ORACLE_HOME environment 
variable not set!
---

Does anybaody know why this happen. the ORACLE_HOME 
enviroment variable is defined and i don't know 
whatcanhappen.

thanks

 Jesús


Problems with Apache::DBI

2000-06-12 Thread Webmast98

Hello, 
This message is urgent and could save our banner exchange.
Recently we started growing so fast that we had to convert our entire system 
at Traffic-Exchange.com to mysql. Now that this is done we need persistant 
database connections to the mysql server. From downloading the Apache::DBI 
module I have no idea how to set this up.

But what I can tell you is that we connect to the mysql database 1 time for 
every banner that is called by having this in our perl script:
use DBI;
$dbh = 
DBI-connect("dbi:mysql:$mysqldatabase","$mysqlusername","$mysqlpassword") || 
die("Couldn't connect to database!\n");
updatedatabase;
$dbh-disconnect;

Each time a banner is called that code is execuited meaning the database 
would open over 1,000 in a few min.

From seeng this how is it that I can change this to use your module for 
persistant connections and what is it I need to do.

The README was a bit confusing.



Re: mod_perl: Configuration info at run-time

2000-06-12 Thread Rob Tanner

I don't have my eagle book in front of me (two work places, onbe book) -- 
in chapter 9, I think it's a mod_perl specific method (might be a server 
method though, can't remember) -- and I don't remember the name of the 
function either -- but basically it returns a list of all configured 
virtual hosts.

If no one else responds with a chapter and verse quote, skim through 
chapter nine -- it's a full fledged reference manual -- and you should find 
it.

-- Rob

--On Monday, June 12, 2000 11:10 AM -0400 "Richard L. Goerwitz" 
[EMAIL PROTECTED] wrote:

 It's not obvious to me how one might get a list of VirtualHosts that are
 configured for the current server instance (at run-time, e.g., from in-
 side a Perl module).

 Is there some canonical way to do this?

 --
 Richard Goerwitz  [EMAIL PROTECTED]




   _ _ _ _   __ _ _ _ _
  /\_\_\_\_\/\_\ /\_\_\_\_\_\
 /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
/\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_//\/_/
  /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

  Rob Tanner
  McMinnville, Oregon
  [EMAIL PROTECTED]



Re: mod_perl: Configuration info at run-time

2000-06-12 Thread Matt Sergeant

On Mon, 12 Jun 2000, Rob Tanner wrote:

 I don't have my eagle book in front of me (two work places, onbe book) -- 
 in chapter 9, I think it's a mod_perl specific method (might be a server 
 method though, can't remember) -- and I don't remember the name of the 
 function either -- but basically it returns a list of all configured 
 virtual hosts.
 
 If no one else responds with a chapter and verse quote, skim through 
 chapter nine -- it's a full fledged reference manual -- and you should find 
 it.

It's server-next():

for (my $s = Apache-server; $s; $s = $s-next()) {
print "Virtual host: ", $s-server_hostname, "\n";
}

-- 
Matt/

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




Connect to Informix remote DB

2000-06-12 Thread James Xie


I have two Linux (Redhat 6.0) boxes both have Apache 1.3.12 and mod_perl
1.23 installed, one of them (let's call  it A box) also has Informix 7.3
installed.  I installed DBI module and Informix DBD (1.0) on both machines,
On B box, "make test"  for informix DBD went through ok against the database
on A box. 

The following DBI script went through ok on A Box, but it failed on B box. 


my $host = $r-get_remote_host;
my $dbh = DBI-connect("DBI:Informix:esorn");
my $sth = $dbh-prepare("SELECT * FROM user" ); 
.

Here is what I got from the error_log on B box: 
DBI-connect failed: SQL: -951: Incorrect password or user webuser
is not known on the database server. at /usr/local/esorn/lib
/perl/Apache/TestDBI.pm line 12

webuser is the account I run Apache process. 


When I change the script as following:

my $host = $r-get_remote_host;
my $dbh = DBI-connect("DBI:Informix:esorn","informix","informix");
my $sth = $dbh-prepare("SELECT * FROM user" ); 
.

Here is what I got from the error_log on B box: 
DBI-connect failed: SQL: -952: User's password is not correct for
the database server.

The user "informix" with password "informix" do exist on A box. 


How do I fix this problem ?

Thanks

James




RE: Problems with Apache::DBI

2000-06-12 Thread John Keiser

From what I read about the module, it overrides connect() and checks if the
connection has already been made.  Overrides disconnect to not actually
disconnect.  Pretty darn nifty.

--John

-Original Message-
From: Rob Tanner [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 12, 2000 10:53 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Problems with Apache::DBI


Believe it or not, it's the simplest task in the world.  In startup.pl add
the line "PerlModule Apache::DBI"  I'm not sure how it does it's magic, but
basically, with that module loaded, DBI connection open/close requests go
through it and it maintains a persistant connection for you (the close is
replaced with a null, etc, so you don't even have to modify your banner
module.  If you've installed Apache::DBI, simply grab the manpage, but
basically, all you do is add it to startup.pl.  Neat, ain't it!! :-)

-- Rob

--On Monday, June 12, 2000 12:14 PM + [EMAIL PROTECTED] wrote:

 Hello,
 This message is urgent and could save our banner exchange.
 Recently we started growing so fast that we had to convert our entire
 system  at Traffic-Exchange.com to mysql. Now that this is done we need
 persistant  database connections to the mysql server. From downloading
 the Apache::DBI  module I have no idea how to set this up.

 But what I can tell you is that we connect to the mysql database 1 time
 for  every banner that is called by having this in our perl script:
 use DBI;
 $dbh =
 DBI-connect("dbi:mysql:$mysqldatabase","$mysqlusername","$mysqlpassword"
 ) ||  die("Couldn't connect to database!\n");
 updatedatabase;
 $dbh-disconnect;

 Each time a banner is called that code is execuited meaning the database
 would open over 1,000 in a few min.

 From seeng this how is it that I can change this to use your module for
 persistant connections and what is it I need to do.

 The README was a bit confusing.




   _ _ _ _   __ _ _ _ _
  /\_\_\_\_\/\_\ /\_\_\_\_\_\
 /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
/\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_//\/_/
  /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

  Rob Tanner
  McMinnville, Oregon
  [EMAIL PROTECTED]




Re: Problems with Apache::DBI

2000-06-12 Thread Drew Taylor

One other thing: Make sure the 'use Apache::DBI' comes before 'use DBI'
in your startup.pl or httpd.conf file. Very important little step. :-)
Other than that, it's a 5 minute drop in that works wonderfully!

Rob Tanner wrote:
 
 Believe it or not, it's the simplest task in the world.  In startup.pl add
 the line "PerlModule Apache::DBI"  I'm not sure how it does it's magic, but
 basically, with that module loaded, DBI connection open/close requests go
 through it and it maintains a persistant connection for you (the close is
 replaced with a null, etc, so you don't even have to modify your banner
 module.  If you've installed Apache::DBI, simply grab the manpage, but
 basically, all you do is add it to startup.pl.  Neat, ain't it!! :-)


-- 
Drew Taylor
Vialogix Communications, Inc.
501 N. College Street
Charlotte, NC 28202
704 370 0550
http://www.vialogix.com/



A question from a naive Perl programmer

2000-06-12 Thread Ehsan Amiri

Hi all
I am a naive perl programmer and I have a simple qustion:

How can I pass parameters to my perl program from command-line?

Thanks
E.A.




RE: Connect to Informix remote DB

2000-06-12 Thread James Xie


I don't have .rhosts on A Box but I do have hosts.equiv on A Box 
c420rux1 (B Box)


B Box also has the entry in sqlhosts pointed to A box (c407rux3):
esorn   onsoctcpc407rux3ifm

I don't think I can pass Informix DBD's make test if I don't have these
things set correctly. 

Thanks



-Original Message-
From: Honza Pazdziora [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 12, 2000 9:52 AM
To: James Xie
Cc: [EMAIL PROTECTED]
Subject: Re: Connect to Informix remote DB


On Mon, Jun 12, 2000 at 09:32:11AM -0700, James Xie wrote:
 
 I have two Linux (Redhat 6.0) boxes both have Apache 1.3.12 and mod_perl
 1.23 installed, one of them (let's call  it A box) also has Informix 7.3
 installed.  I installed DBI module and Informix DBD (1.0) on both
machines,
 On B box, "make test"  for informix DBD went through ok against the
database
 on A box. 

...

Do you have correct .rhosts set on the A box? Does the B box have
sqlhosts that would point esorn to box A?

-- 

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




Re: A question from a naive Perl programmer

2000-06-12 Thread Vivek Khera

 "EA" == Ehsan Amiri [EMAIL PROTECTED] writes:


EA How can I pass parameters to my perl program from command-line?

There is no command line for mod_perl programs.  All info must come
from either the environment or from the URI or from CGI parameters.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.Khera Communications, Inc.
Internet: [EMAIL PROTECTED]   Rockville, MD   +1-301-545-6996
GPG  MIME spoken herehttp://www.khera.org/~vivek/



Re: perl vs java

2000-06-12 Thread Roger Espel Llima

Gunther Birznieks [EMAIL PROTECTED] wrote:
 2. Would you write a chat engine in Perl? I wouldn't! (Well, actually I did 
 5 years ago but I am certainly not proud of that code).

I did, just a few months ago, and it's working very nicely.

 The thing about a real-time chat engine is the same issue as #1, it is 
 really inefficient resource-wise to flush messages to a persistent data 
 store or even using IPC shared memory in Perl in order to allow all the 
 Perl processes to share a common list of chat messages even if only for the 
 last 5 minutes worth of chat.

So don't do it like that :)  My chat engine is a single-threaded,
select()-based plain Perl daemon (no apache there) that takes http
connections on a non-standard port, directly from the browser, and keeps
them open for as long as the browser will.  It speaks http on one end,
and uses the irc-server-to-server protocol to talk to an ircd on the
other.

Technically, yeah, select() is arguably ugly, but if you wrap it around
OO classes for the various kinds of buffers and connections, it's all
quite manageable.

Chat connections are very low bandwith, and a single-threaded design
tends to be memory effective, so I'd expect this setup to handle a few
hundred simultaneous users easily.  If you want more, use a standard irc
daemon as a hub, and connect several such perl servers to it; if you
want to have a java applet client too, it can talk directly to the irc
server.

-- 
Roger Espel Llima, [EMAIL PROTECTED]
http://www.iagora.com/~espel/index.html



Re: A question from a naive Perl programmer

2000-06-12 Thread Rob Tanner

Wrong list for naive perl questions revolving around command-line 
parameters -- but what the hey...  And I hope you're not really trying to 
pass command-line parms to a modperl module, 'cause it won't work.

The simplest way is simple the @ARGV array.  it contains all the 
command-line tokens past the program name (as oppossed to C where argv[0] 
contains the program name).  Just mosey through the list.  It's predefined 
for you.

my num_args = @ARGV;   # number of command line tokens
my first_arg = $ARGV[0];   # first token
my last_arg = $ARGV[$#ARGV];   # last token
etc...

I'm saying tokens instead of args or parameters beacuse if one of your 
parameters is more than one word, such as a person's name, the shell treats 
that as two tokens unless it's surrounded by quotes, i.e.,

John Doe   -- two tokens
"John Doe" -- one token

If you want to get fancier, look at getopt and getopts which are both part 
of the standard perl library.  They handle command-line switches, args, etc 
and do all the hard work for you.

-- Rob

--On Monday, June 12, 2000 9:37 PM +0330 Ehsan Amiri [EMAIL PROTECTED] 
wrote:

 Hi all
 I am a naive perl programmer and I have a simple qustion:

 How can I pass parameters to my perl program from command-line?

 Thanks
 E.A.





   _ _ _ _   __ _ _ _ _
  /\_\_\_\_\/\_\ /\_\_\_\_\_\
 /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
/\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_//\/_/
  /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

  Rob Tanner
  McMinnville, Oregon
  [EMAIL PROTECTED]



RE: Apache children hanging

2000-06-12 Thread Blue

On Mon, 12 Jun 2000, Ken Williams wrote:

 [EMAIL PROTECTED] (Blue) wrote:
 there is a procedure in the mod_peril SUPPORT document that works if you
 
 Uh-oh - is mod_peril a Microsoft product or something?  =)
 
 Perhaps the DSO version of mod_perl should be called mod_peril.

sorry, it's a joke wrt mod_perl + perl 5.6. :)

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

-- 
Blue Lang  Unix Systems Admin
QSP, Inc., 3200 Atlantic Ave, Ste 100, Raleigh, NC, 27604
Home: 919 835 1540  Work: 919 875 6994  Fax: 919 872 4015





Re: oracle error log

2000-06-12 Thread scotta

What happens when you do a 
print qq|%ENV{'ORACLE_HOME'} inside of one of your programs.  I was
under the impression that you had to set these manualy inside your
program rather then using a shell environment setting.
Then again, its 10:30 on a monday so I could be way off base...

Scott

 [Mon Jun 12 17:43:35 2000] [notice] caught SIGTERM, shutting down
 ORACLE_HOME environment variable not set!
 
 Does anybaody know why this happen. the ORACLE_HOME enviroment
 variable is defined and i don't know what can happen.
 
 thanks
 
Jesús



A question from...

2000-06-12 Thread Ehsan Amiri

Hi
Thanks for your responses can you please give me an on-line refrence for

finding answer of such questions(How one can pass parameters to a perl
script)(esp. mailing lists)

E.A.






RE: Apache children hanging

2000-06-12 Thread Paul G. Weiss

Is there any equivalent procedure for debugging core
dumps?  I've tried this and it doesn't work because
the process is not running.  When I process dies it
would be nice to know where it was in the Perl stack.

-P

-Original Message-
From: Doug MacEachern [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 01, 2000 6:27 PM
To: John Armstrong
Cc: Gustavo Duarte; [EMAIL PROTECTED]
Subject: Re: Apache children hanging


 % gdb httpd $pid_of_spinning_process
 % source modperl_x.xx/.gdbinit
 % curinfo

oops, that should be:

% gdb httpd $pid_of_spinning_process
(gdb) source modperl_x.xx/.gdbinit
(gdb) curinfo




Re: Caching and mod_perl

2000-06-12 Thread Richard L. Goerwitz

Regarding my question about mod_perl access to Apache caching utilities,
[EMAIL PROTECTED] wrote:

 See page 120 in the Eagle book for If-Modified-Since caching, using
 update_mtime and set_last_modified.  Except for the creation of temp
 files and unlinking, this is somewhat similar to what
 ap_proxy_cache_update is doing in mod_proxy.

Maybe I read that chapter all wrong, but I thought the problem to be
solved there was that of providing clients with enough information to
effectively cache what, in fact, was a dynamically generated navigation
bar.

What I'm interested in knowing is whether anybody's written an inter-
face to the actual Apache caching utility routines.

-- 
Richard Goerwitz[EMAIL PROTECTED]



Re: Problems with Apache::DBI

2000-06-12 Thread Matt Carothers



On Mon, 12 Jun 2000, Rob Tanner wrote:

 Believe it or not, it's the simplest task in the world.  In startup.pl add 
 the line "PerlModule Apache::DBI"

You can either stick "PerlModule Apache::DBI" in your httpd.conf or add
'use Apache::DBI ();' to your startup.pl.  Also, for mysql, you'll need 
to add a keepalive routine to your startup.pl:

sub Apache::DBI::db::ping {
my $dbh = shift;
return $dbh-do('select 1');
}

- Matt






Re: Problems with Apache::DBI

2000-06-12 Thread Edmund Mergl

Matt Carothers wrote:
 
 On Mon, 12 Jun 2000, Rob Tanner wrote:
 
  Believe it or not, it's the simplest task in the world.  In startup.pl add
  the line "PerlModule Apache::DBI"
 
 You can either stick "PerlModule Apache::DBI" in your httpd.conf or add
 'use Apache::DBI ();' to your startup.pl.  Also, for mysql, you'll need
 to add a keepalive routine to your startup.pl:
 
 sub Apache::DBI::db::ping {
 my $dbh = shift;
 return $dbh-do('select 1');
 }
 
 - Matt



this is safer:


sub Apache::DBI::db::ping {
my $dbh = shift;
my $ret = 0;
eval {
local $SIG{__DIE__}  = sub { return (0); };
local $SIG{__WARN__} = sub { return (0); };
$ret = $dbh-do('select 1');
};
return ($@) ? 0 : $ret;
}


Edmund

-- 
Edmund Mergl
mailto:[EMAIL PROTECTED]
http://www.edmund-mergl.de
fon: +49 700 EDEMERGL



Problem compiling with HPUX 11 64-bit OS

2000-06-12 Thread Scott Phan

Help,

I’m trying to compile mod_perl on 64-bit HPUX 11.  The following error
occurs during the make process:

cc -c  -I./os/unix -I./include   -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -
DUSE_EXPAT -I./lib/expat-lite -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFI
LE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -DMOD_PERL modules.c
cc -c  -I./os/unix -I./include   -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -
DUSE_EXPAT -I./lib/expat-lite -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFI
LE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -DMOD_PERL buildmark.c
cc  -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite
 -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS
=64 -Ae -DMOD_PERL\
  -o httpd buildmark.o modules.o modules/perl/libperl.a
modules/standard/libstandard.a main/libmain.a ./os/unix/libos.a ap/libap.a
regex/libregex.a lib/expat-lite/libexpat.a `perl
/export/scottp/mod_perl-1.24/src/modules/perl/ldopts  ` -lm -lpthread
/usr/ccs/bin/ld: Unsatisfied symbols:
   dlclose (code)
   dlopen (code)
   dlerror (code)
   dlsym (code)
gmake[1]: *** [target_static] Error 1
gmake[1]: Leaving directory `/export/scottp/apache_1.3.9/src'
gmake: *** [apache_httpd] Error 2


I have Apache 1.3.9 source code and 1.24 for mod_perl

The configuration flags are:

# perl Makefile.PL
Configure mod_perl with ../apache_1.3.9/src ? [y]
Shall I build httpd in ../apache_1.3.9/src for you? [y]
Appending mod_perl to src/Configuration
Using config file: /export/scottp/mod_perl-1.24/src/Configuration
Creating Makefile
 + configured for HP-UX 11 platform
 + setting C compiler to cc
 + setting C pre-processor to cc -E
 + checking for system header files
 + adding selected modules
 + checking sizeof various data types
 + doing sanity check on compiler and options
Creating Makefile in support
Creating Makefile in regex
Creating Makefile in os/unix
Creating Makefile in ap
Creating Makefile in main
Creating Makefile in lib/expat-lite
Creating Makefile in modules/standard
EXTRA_CFLAGS: -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -DUSE_EXPAT -I$(SRCD
IR)/lib/expat-lite
PerlDispatchHandler.disabled (enable with PERL_DISPATCH=1)
PerlChildInitHandlerenabled
PerlChildExitHandlerenabled
PerlPostReadRequestHandler..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.enabled
PerlLogHandler..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...enabled
PerlServerApi...enabled
PerlSectionsdisabled (enable with PERL_SECTIONS=1)

PerlSSI.disabled (enable with PERL_SSI=1)

Will run tests as User: 'nobody' Group: 'sys'
Checking CGI.pm VERSION..ok
Checking for LWP::UserAgent..failed
Can't locate LWP/UserAgent.pm in @INC (@INC contains: ./lib
/opt/perl5/lib/5.6.0/PA-RISC2.0 /opt/perl5/lib/5.6.0
/opt/perl5/lib/site_perl/5.6.0/PA-RISC2.0 /opt/perl5/lib/site_perl/5.6.0
/opt/perl5/lib/site_perl/5.005/PA-RISC2.0 /opt/perl5/lib/site_perl/5.005
/opt/perl5/lib/site_perl .) at Makefile.PL line 1056.

The libwww-perl library is needed to run the test suite.
Installation of this library is recommended, but not required.

Checking for HTML::HeadParserfailed
Can't locate HTML/HeadParser.pm in @INC (@INC contains: ./lib
/opt/perl5/lib/5.6.0/PA-RISC2.0 /opt/perl5/lib/5.6.0
/opt/perl5/lib/site_perl/5.6.0/PA-RISC2.0 /opt/perl5/lib/site_perl/5.6.0
/opt/perl5/lib/site_perl/5.005/PA-RISC2.0 /opt/perl5/lib/site_perl/5.005
/opt/perl5/lib/site_perl .) at Makefile.PL line 1074.

The HTML-Parser package is needed (by libwww-perl) to run the test suite.
Writing Makefile for Apache
Writing Makefile for Apache::Connection
Writing Makefile for Apache::Constants
Writing Makefile for Apache::File
Writing Makefile for Apache::Leak
Writing 

RE: Help writting a module for Apache.

2000-06-12 Thread Jerrad Pierce

Apache::Authen?

As for your method, 401 username password stuff is always accessible via:
$ENV{AUTHORIZATION}

  o _
 /|/ |   Jerrad Pierce \ | __|_ _|
 /||/   http://pthbb.org  .  | _|   |
 \||  _.-~-._.-~-._.-~-._@"  _|\_|___|___|


 -Original Message-
 From: Ariel Manzur [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 29, 2000 09:09
 To: [EMAIL PROTECTED]
 Subject: Help writting a module for Apache.
 
 
 Hi..
 
 I need Apache to do this: always ask for basic 
 authentication, and then
 accept any conbination of username/password as correct, and set an
 enviroment variable with the password sent on the request, so I can
 retrieve that on a CGI script, and do the real authentication there.
 I couldn't find a way to do that with the 'standard' apache 
 modules, so I
 have to write one, and I have some questions:
 
 - is that any module that alredy does that? :)
 - Can anyone point me to a "real life" example, or guide, on 
 how to write
 and install a module using mod_perl? I use perl a lot, but I 
 could find
 "easy" documentation on how to write modules (I don't want to 
 read a _huge_
 man page for this simple task)
 
 Can anyone help? Thanks!!
 
 Bye..
 
 Ariel.
 



RE: sendMail in cgi program

2000-06-12 Thread Jerrad Pierce

This is not for CGI however, the problem is simple.
EOF must be at the beginning of the line, no white space in front of it

  o _
 /|/ |   Jerrad Pierce \ | __|_ _|
 /||/   http://pthbb.org  .  | _|   |
 \||  _.-~-._.-~-._.-~-._@"  _|\_|___|___|


 -Original Message-
 From: amy [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 12, 2000 15:55
 To: [EMAIL PROTECTED]
 Subject: sendMail in cgi program
 
 
 if I run the same procedure on a separate file,
 email works, once I put the proc in the cgi
 file, I got the following error.
 
 in error_log :
 Can't find string terminator "EOF" anywhere before EOF at
 /usr/local/bin/apache/cgi-bin/lib.pl line 484.
 
 sub sendEmail {
 
 open (Sendmail, "|/usr/lib/sendmail -oi -t ")
 or die "Can't fork for sendmail: $!\n";
 
 484  print Sendmail "EOF";
 From: Bugs amy\@longsys.com
 To: amy amy\@longsys.com
 Subject: Test Create
 
 test create
 
 EOF
 close(Sendmail);
 
 }
 
 Please help.  Thank You.
 



RE: Help writting a module for Apache.

2000-06-12 Thread Ariel Manzur

The script is inside a password protected directory, so if I can access the
script, it means I sent a correct username and password (right?). The
"AUTHORIZATION" key inside %ENV doesn't exist.. There is a
$ENV{'AUTH_TYPE'}, it contains "basic".. I tested it on apache 1.3.6 and
1.3.3..

At 16:16 12/06/2000 -0400, Jerrad Pierce wrote:
Then you haven't gotten a username and password back, you should get 
basic authinfo

Where authinfo is a b64 encoded string that is
username:password
 Are you sure? I tryed $ENV{AUTHORIZATION} in normal cgi scripts and in
 Apache::Registry and the variable is empty..
 
 How do I use that module?
 
 At 16:00 12/06/2000 -0400, Jerrad Pierce wrote:
 Apache::Authen?
 
 As for your method, 401 username password stuff is always 
 accessible via:
 $ENV{AUTHORIZATION}
 
  Hi..
  
  I need Apache to do this: always ask for basic 
  authentication, and then
  accept any conbination of username/password as correct, and set an
  enviroment variable with the password sent on the request, so I can
  retrieve that on a CGI script, and do the real 
 authentication there.
  I couldn't find a way to do that with the 'standard' apache 
  modules, so I
  have to write one, and I have some questions:
  
  - is that any module that alredy does that? :)
  - Can anyone point me to a "real life" example, or guide, on 
  how to write
  and install a module using mod_perl? I use perl a lot, but I 
  could find
  "easy" documentation on how to write modules (I don't want to 
  read a _huge_
  man page for this simple task)
  
  Can anyone help? Thanks!!
  
  Bye..
  
  Ariel.
  
 




RE: Problem compiling with HPUX 11 64-bit OS

2000-06-12 Thread Gavin Mathias

Add these lines to the apache Configuration file in the src directory

EXTRA_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
EXTRA_LIBS=`perl -MExtUtils::Embed -e ldopts`

and recompile.

Regards,
Gavin


 -Original Message-
From:   Scott Phan [mailto:[EMAIL PROTECTED]]
Sent:   Monday, June 12, 2000 10:41 AM
To: [EMAIL PROTECTED]
Subject:Problem compiling with HPUX 11 64-bit OS

Help,

I'm trying to compile mod_perl on 64-bit HPUX 11.  The following error
occurs during the make process:

cc -c  -I./os/unix -I./include   -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -
DUSE_EXPAT -I./lib/expat-lite -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFI
LE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -DMOD_PERL modules.c
cc -c  -I./os/unix -I./include   -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -
DUSE_EXPAT -I./lib/expat-lite -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFI
LE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -DMOD_PERL buildmark.c
cc  -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite
 -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS
=64 -Ae -DMOD_PERL\
  -o httpd buildmark.o modules.o modules/perl/libperl.a
modules/standard/libstandard.a main/libmain.a ./os/unix/libos.a ap/libap.a
regex/libregex.a lib/expat-lite/libexpat.a `perl
/export/scottp/mod_perl-1.24/src/modules/perl/ldopts  ` -lm -lpthread
/usr/ccs/bin/ld: Unsatisfied symbols:
   dlclose (code)
   dlopen (code)
   dlerror (code)
   dlsym (code)
gmake[1]: *** [target_static] Error 1
gmake[1]: Leaving directory `/export/scottp/apache_1.3.9/src'
gmake: *** [apache_httpd] Error 2


I have Apache 1.3.9 source code and 1.24 for mod_perl

The configuration flags are:

# perl Makefile.PL
Configure mod_perl with ../apache_1.3.9/src ? [y]
Shall I build httpd in ../apache_1.3.9/src for you? [y]
Appending mod_perl to src/Configuration
Using config file: /export/scottp/mod_perl-1.24/src/Configuration
Creating Makefile
 + configured for HP-UX 11 platform
 + setting C compiler to cc
 + setting C pre-processor to cc -E
 + checking for system header files
 + adding selected modules
 + checking sizeof various data types
 + doing sanity check on compiler and options
Creating Makefile in support
Creating Makefile in regex
Creating Makefile in os/unix
Creating Makefile in ap
Creating Makefile in main
Creating Makefile in lib/expat-lite
Creating Makefile in modules/standard
EXTRA_CFLAGS: -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -DUSE_EXPAT -I$(SRCD
IR)/lib/expat-lite
PerlDispatchHandler.disabled (enable with PERL_DISPATCH=1)
PerlChildInitHandlerenabled
PerlChildExitHandlerenabled
PerlPostReadRequestHandler..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.enabled
PerlLogHandler..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...enabled
PerlServerApi...enabled
PerlSectionsdisabled (enable with PERL_SECTIONS=1)

PerlSSI.disabled (enable with PERL_SSI=1)

Will run tests as User: 'nobody' Group: 'sys'
Checking CGI.pm VERSION..ok
Checking for LWP::UserAgent..failed
Can't locate LWP/UserAgent.pm in @INC (@INC contains: ./lib
/opt/perl5/lib/5.6.0/PA-RISC2.0 /opt/perl5/lib/5.6.0
/opt/perl5/lib/site_perl/5.6.0/PA-RISC2.0 /opt/perl5/lib/site_perl/5.6.0
/opt/perl5/lib/site_perl/5.005/PA-RISC2.0 /opt/perl5/lib/site_perl/5.005
/opt/perl5/lib/site_perl .) at Makefile.PL line 1056.

The libwww-perl library is needed to run the test suite.
Installation of this library is recommended, but not required.

Checking for HTML::HeadParserfailed
Can't locate HTML/HeadParser.pm in @INC (@INC contains: ./lib
/opt/perl5/lib/5.6.0/PA-RISC2.0 /opt/perl5/lib/5.6.0
/opt/perl5/lib/site_perl/5.6.0/PA-RISC2.0 

mod_perl handler generated proxy requests

2000-06-12 Thread Marc D. Spencer

I have a mod_perl module which would like to make an HTTP request to 
a tertiary server and then process the result before possibly 
returning some subset of that data.

I have already written a working solution via LWP, but I got to 
wondering, as I sometimes do, whether there is a better way to do it 
via a sub-request and mod_proxy.

Has anyone done this? Is this a better or worse approach compared to 
LWP? And if it's better, could you point me toward some code?




Re: Perl vs Java [Now OT]

2000-06-12 Thread Perrin Harkins

On Mon, 12 Jun 2000, Gunther Birznieks wrote:
 Unless you use a cluster of servers for load balancing and high
 availability, in which case you're right back where you started and you
 need the Java equivalent of Apache::Session::DBI.  I imagine someone has
 written one in one of the many servlet runners out there.
 
 1) Many load balancers actually recognize this and do provide some load 
 balancing on IP address. This is definately not perfect of course (when you 
 have ISP proxies like AOL)... and then when a machine goes down, it's just 
 tough luck that the user has to get redirected and relogin or do whatever 
 for the session.

It's that second part that is a problem for me.  We do a write-through
cache to deal with this, i.e. we write all data to both a local cache
(shared memory, courtesy of BerkeleyDB 3) and a shared database.  Reads
check the cache first, and don't bother to go to the database unless what
they want isn't cached.  If a machine fails, we only lose the cache.

I know some of the commercial java stuff does the same thing and provides
a nice API for using it.

Threading certainly does have its allure, and I agree that Apache::Session
is neat and that Perl's TIE mechanism is inadequate for the job.

- Perrin




[OT] Re: sendMail in cgi program

2000-06-12 Thread Paul

I know you've received other responses, but I'm doing a good bit of
this lately.

 sub sendEmail {
 open (Sendmail, "|/usr/lib/sendmail -oi -t ")
 or die "Can't fork for sendmail: $!\n";
 print Sendmail "EOF";
 From: Bugs amy\@longsys.com
 To: amy amy\@longsys.com
 Subject: Test Create
 test create
 EOF
 close(Sendmail);
 }

As someone mentioned on the board (ever so briefly), here-documents
like this one require that your "sentinel" string have no leading
whitespace.

e.i., you may say 
   $var=END;
  This is my variable's
  multiline text,
  complete tith tabs\t\t and extra newline\n\n, etc
END

but you *can't* say 
   $var=END;
  blah
   END

because here, END has space in front of it.
In several shells you can put tabs in front of it if you say
   print-END; # the dash says "let me use a leading tab"
   blah
tab hereEND

but I'm not sure what Perl thinks about that (I don't think it likes
it), and even in shells, it usually has to be tabs, not just
whitespace.

Note also (and please forgive me if I'm rambling =o) that the default
interpolation is double-quotish, so
   printEND;
is exactly equivalent to 
   print"END";

Both tell Perl (or the shell) to do string interpolation on the
here-doc, so you can embed variables.  On the other hand,
   print'END';
means use single-quotish behavior, and won't interpolate the vars,
which is sometimes useful.  And yes, this does mean that you can use
   print`END`;
  ls -l
  echo "Hi, Mom!\n\n"
END

...though there are probably better ways to perform such chicanery. :o/

I've found only sparse documentation for this trick (at least in basic
perl-specific docs), but use it a pretty good bit, especially in CGI's
that are going to send a lot of JavaScript (or some such) to the
client.  It's a reasonably readable way to practically switch languages
mid-script, but gives you access to some neat tricks via interpolation.
e.g., 
#~
$JS=END;
   // now writing JavaScript 
   function foo(bar) {
  // blah, $blah, $bleep{$glurf}
   }
   function bar(foo) {
  // blah, blah
   }
END
# and back to "pure" Perl ( =o)
print $query-header,
  $query-start_html(-title  = $title,
 -script = $JS,   # the above JavaScript
 -onLoad = "foo($x);",
  ), "\n"; 
#__


The biggest problem (for me, anyway) is that it throws off my
formatting to have to stick in that line with no leading whitespace.
I do it anyway a lot of the time, but if that's a problem, there's
always (well, usually, lol) qq{}.  e.g., the above example, rewritten,
would be
   $var = qq{
  blah
   };

Again, forgive me if you knew that.

As a seperate problem, your example has whitespace in front of the
"From:", "To:" and "Subject:" headers as well -- I can't say I'm an
expert on those, but does that work? Might want to test it to be sure. 
In the end, all things considered, it might work better to just build
it the hard way --
   print Sendmail "To:...\n",
  "From:...\n",
  "Subject:...\n\n", # note double newline
  # content stuff here
  "\n";

One more consideration -- I believe the specs demand a blank line after
all the headers, to signify that "the text starts *here*".

Hope that helps. =o)
And if not, sorry for rambling so! lol!

Paul

"Government should be like cooking a small fish -- don't overdo it."
   -- Lao Tzu



__
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com



Re: Template techniques

2000-06-12 Thread Perrin Harkins

On Mon, 12 Jun 2000, Roger Espel Llima wrote:
 The focus of my module (it'll probably be called 'iAct') is quite
 different, though.  The html-embedded command set is limited to a set of
 strictly declarative features;

You don't have to use the fancier stuff in TT.  Our designers only use
basical conditionals and looping.

 So, a file describing an article might look like this:
 
 % # "sticks this into an article template" %
 % parent src="../articles.tmpl" %
 
 % # "this stuff could be multilingual, with alternate languages in the
   same file, or not" %
 % section name="title" %The Title of My Article% /section %
 % section name="image" %img src="/images/myarticle.png"% /section %
 % section name="author" %Joe Public% /section %
 % section name="text" %
 blah blah blah blah blah blah blah blah
 blah blah blah blah blah blah blah blah
 
 The "parent" file, articles.tmpl, is the template that all such articles
 would use, and is just a set of section definitions (possibly just one),
 with gaps for the sections defined in the child.  
 
 In the simplest case, the articles.tmpl file would be like:
 
 % # "the 'page' section is what goes to the browser, in the absence of a
   'parent' declaration" %
 % section name="page" %
 htmlheadtitleMy Site - Articles - $ title $/title/head
 body
 h1$ title $, by $ author $/h1
 $ text $
 /body/html
 
 More realistically, the articles template would also have a parent,
 which could be the common ancestor of all the pages on the site, and
 handle all the shared navigation features, defining the main table
 where everything is inserted, while leaving a $ named_gap $ for the
 contents of the central td.  Even more realistically, each major
 section of a site would have its own global template, defining the
 common design elements in that section, and having the global template
 as its own parent.

Honestly, I'm not trying to tell you not to write your own thing for
the pure fun of it, but this is all already available in TT.  Variable
declaration, search paths for templates, including other templates and
passing them variables, etc.  It's all there.  This is all there in Mason
as well, which recently added cool inheritance features making this kind
of thing simpler.

 To do dynamic parts, you use the % call sub="Module::sub" % command,

That's there to.  You can map any arbitrary function call into TT, or
write a plugin if you need object state.

 That's exactly what we were doing before: SSI-ish stuff for the
 near-static pages, and Apache::Registry scripts using CGI::FastTemplate
 for the mostly dynamic ones.

You may be aware of this already, but CGI::FastTemplate does not compile
to perl.  It uses regular expressions and parses the template every
time.  A perl compilation method will ultimately be faster.

CGI::FastTemplate should actually work fine for SSI-ish stuff, since it
doesn't cache and won't use up all your memory storing compiled perl code.

- Perrin




Re: perl vs java

2000-06-12 Thread Gunther Birznieks

Now, now...that is unfair. I was referring to writing in pure Perl vs pure 
Java.

Of course, C apis and pre-written daemon integration makes the glue 
language a moot point (and favors Perl actually).

BTW, is select() is still broken in Win32 Perl? It was 6 months ago (I 
suspect because IO operates differently on win32) so you'd limit your 
platform too.

Later,
Gunther

At 06:21 PM 6/12/00 +, Shane Nay wrote:
(Somehow I missed Gunther's message, maybe I had a system out for a little
while, I'm replying to Roger, but really replying to Gunther)

  On Mon, 12 Jun 2000, you wrote:
  Gunther Birznieks [EMAIL PROTECTED] wrote:
   2. Would you write a chat engine in Perl? I wouldn't! (Well, actually 
 I did
   5 years ago but I am certainly not proud of that code).

Hmm..., yes I would.  At this point, long before I would write it in 
Java.  You
know why?  Not because of anything in perl necessarily, but actually what you
can do with perl.  You see, a perl XS module can take advantage of anything
inside of C.  If I were to write a new version of the chat engine I wrote, I
wouldn't do it this way.  In fact I started re-writing it based on a 
sigqueues,
and CORBA.  Corba pre-fetch of everything running around, dump into memory,
sigqueues pick up request from client via httpd protocol (obviously not port
80, this is a special purpose HTTPD engine).  Stream out based on pre-fetched
CORBA content.  I started writing it, but got distracted by the fact that 
I ran
out of money :-), happens to the best of us.

Java can talk to Corba natively, so the application side talks to the corba
server, and dumps/retrieves it's messages into there.  Two threads involved in
the special purpose httpd engine.  One that fetches content from the CORBA
engine, the other that streams out to clients based on sigqueus (Similar to
phhttpd, but much simpler).  The locking issues on the Corba content is so
yucky I don't even want to discuss it (That's sort of where I left 
off).  I ran
some benchmarks, and the httpd engine could handle over 1000 requests per
second per server.  The corba fetch was really trivial, so the only "problem"
was the communication between the applications and omniORB (Corba Object
Request Broker, really good piece of software BTW, best ORB out there in terms
of speed)

 
  I did, just a few months ago, and it's working very nicely.
 
   The thing about a real-time chat engine is the same issue as #1, it is
   really inefficient resource-wise to flush messages to a persistent data
   store or even using IPC shared memory in Perl in order to allow all the
   Perl processes to share a common list of chat messages even if only 
 for the
   last 5 minutes worth of chat.
 
  So don't do it like that :)  My chat engine is a single-threaded,
  select()-based plain Perl daemon (no apache there) that takes http
  connections on a non-standard port, directly from the browser, and keeps
  them open for as long as the browser will.  It speaks http on one end,
  and uses the irc-server-to-server protocol to talk to an ircd on the
  other.

Well, yes that's the easiest way to do it with perl.  The other way is to 
write
some XS modules which plug into an sigqueue engine, and handle it that way.
Honestly though, if you're going to be writing XS modules to talk to signal
queues, you might as well write the damn thing in c :-).

  Technically, yeah, select() is arguably ugly, but if you wrap it around
  OO classes for the various kinds of buffers and connections, it's all
  quite manageable.

Select might be ugly, but it's how nearly every realtime system works.  So if
you want a realtime system you need to look into select, poll (ugh), and
sigqueues.

  Chat connections are very low bandwith, and a single-threaded design
  tends to be memory effective, so I'd expect this setup to handle a few
  hundred simultaneous users easily.  If you want more, use a standard irc
  daemon as a hub, and connect several such perl servers to it; if you
  want to have a java applet client too, it can talk directly to the irc
  server.

Nothing could be more true.  Single thread is the ONLY way to go..., anything
other than that is a massive waste of trying to implement.

Thanks,
Shane.

--


__
Gunther Birznieks ([EMAIL PROTECTED])
Extropia - The Web Technology Company
http://www.extropia.com/




Re: perl vs java

2000-06-12 Thread Perrin Harkins

On Mon, 12 Jun 2000, Shane Nay wrote:
 If I were to write a new version of the chat engine I wrote, I
 wouldn't do it this way.  In fact I started re-writing it based on a
 sigqueues, and CORBA.

Shane, you are a maniac!  You wrote a chat server using sigqueues and
CORBA?  Isn't that like killing a mosquito with an atomic bomb?

- Perrin




cvs commit: modperl-2.0/src/modules/perl mod_perl.c

2000-06-12 Thread dougm

dougm   00/06/12 11:20:55

  Modified:src/modules/perl mod_perl.c
  Log:
  make sure vhost config points to a mip
  
  Revision  ChangesPath
  1.16  +23 -16modperl-2.0/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- mod_perl.c2000/06/12 03:30:51 1.15
  +++ mod_perl.c2000/06/12 18:20:55 1.16
  @@ -42,39 +42,38 @@
   return perl;
   }
   
  -void modperl_init(server_rec *s, ap_pool_t *p)
  +void modperl_init(server_rec *base_server, ap_pool_t *p)
   {
  -server_rec *base_server = s;
  -server_rec *srvp;
  +server_rec *s;
  +modperl_srv_config_t *base_scfg =
  +  (modperl_srv_config_t *)
  +ap_get_module_config(base_server-module_config, perl_module);
   PerlInterpreter *base_perl = modperl_startup(base_server, p);
  -modperl_interp_init(base_server, p, base_perl);
   
  -{
  -MP_dSCFG(base_server);
  -MpInterpBASE_On(scfg-mip-parent);
  -}
  +modperl_interp_init(base_server, p, base_perl);
  +MpInterpBASE_On(base_scfg-mip-parent);
   
  -for (srvp=base_server-next; srvp; srvp=srvp-next) {
  -MP_dSCFG(srvp);
  +for (s=base_server-next; s; s=s-next) {
  +MP_dSCFG(s);
   PerlInterpreter *perl = base_perl;
   
   if (1) {
   /* XXX: using getenv() just for testing here */
   char *do_alloc = getenv("MP_SRV_ALLOC_TEST");
   char *do_clone = getenv("MP_SRV_CLONE_TEST");
  -if (do_alloc  strEQ(do_alloc, srvp-server_hostname)) {
  +if (do_alloc  strEQ(do_alloc, s-server_hostname)) {
   MpSrvPERL_ALLOC_On(scfg);
   }
  -if (do_clone  strEQ(do_clone, srvp-server_hostname)) {
  +if (do_clone  strEQ(do_clone, s-server_hostname)) {
   MpSrvPERL_CLONE_On(scfg);
   }
   }
   
   /* if alloc flags is On, virtual host gets its own parent perl */
   if (MpSrvPERL_ALLOC(scfg)) {
  -perl = modperl_startup(srvp, p);
  +perl = modperl_startup(s, p);
   MP_TRACE_i(MP_FUNC, "modperl_startup() server=%s\n",
  -   srvp-server_hostname);
  +   s-server_hostname);
   }
   
   #ifdef USE_ITHREADS
  @@ -83,13 +82,21 @@
*/
   if (MpSrvPERL_ALLOC(scfg) || MpSrvPERL_CLONE(scfg)) {
   MP_TRACE_i(MP_FUNC, "modperl_interp_init() server=%s\n",
  -   srvp-server_hostname);
  -modperl_interp_init(srvp, p, perl);
  +   s-server_hostname);
  +modperl_interp_init(s, p, perl);
   }
   
   /* if we allocated a parent perl, mark it to be destroyed */
   if (MpSrvPERL_ALLOC(scfg)) {
   MpInterpBASE_On(scfg-mip-parent);
  +}
  +
  +if (!scfg-mip) {
  +/* since mips are created after merge_server_configs()
  + * need to point to the base mip here if this vhost
  + * doesn't have its own
  + */
  +scfg-mip = base_scfg-mip;
   }
   #endif
   }