Re: cgis and subrequests

2000-08-20 Thread Alex Menendez

unfortunately, I am not entirely sure what a cgi is going  to output all the
time. The cgi might try to do a redirect using the Location field. Therefore,
I don't think I can simply send_http_headers as type text/html...

thanx, though
-amen

Rick Myers wrote:

> On Aug 20, 2000 at 19:38:53 -0700, Alex Menendez twiddled the keys to say:
> > cgi scripts. the module uses lookup_uri() to generate a subrequest then
> > calls  run() to output the actual contents of the file. the eagle book
> > says that calling run() on a subrequest should automatically send the
> > client the appropriate http headers and the document's body. However, I
> > have found that this is not the case. The following code does not send
> > http headers for both cgis and html docs. The body stuff is working fine
> > but the headers are not being sent:
> >
> > my $uri = $r->uri;
> > unless(!$r->args) {
> > $uri = $uri .'?'.$r->args;
> > }
> > my $subr = $r->lookup_uri($uri);
> > if($r->dir_config('is_cgi')) {
> > $subr->handler('cgi-script');
> > } else {
> > $subr->handler('server-parsed');
> > }
> > $subr->run();
> > my $status = $subr->status;
> > $r->print(&create_img_tag($file,$SCRIPT_ON,$status));
> > return $status;
> >
> > any ideas?
>
> Yes. run() no longer sends headers (as far as I know). I don't know when
> it was changed, but it pre-dates my experience. I've had the following
> working just fine for close to a year now (or maybe my sense of time is
> warped :).
>
>   my $lookup = $r->lookup_uri( $uri );
>   $r->send_http_header( 'text/html' );
>   my $status = $lookup->run;
>   $r->status( $status );
>
> Rick Myers[EMAIL PROTECTED]
> 
> The Feynman Problem   1) Write down the problem.
> Solving Algorithm 2) Think real hard.
>   3) Write down the answer.




Re: setting LD_LIBRARY_PATH via PerlSetEnv does not work

2000-08-20 Thread Yann Ramin

As far as FreeBSD goes, LD_LIBRARY_PATH is not searched for setuid
programs (aka, Apache). This isn't a problem for CGIs since they don't
do a setuid (and are forked off), but Apache does, and mod_perl is in
Apache.  I think thats right anyway :)

You could solve this globaly by running ldconfig (I assume Linux has it,
FreeBSD does).  You'd be looking for:

ldconfig -m 

Hope that helps.

Yann

Richard Chen wrote:
> 
> This is a redhat linux 6.2 box with perl 5.005_03, Apache 1.3.12,
> mod_perl 1.24, DBD::Oracle 1.06, DBI 1.14 and oracle 8.1.6.
> For some odd reason, in order to use DBI, I have to set
> LD_LIBRARY_PATH first. I don't think I needed to do this when I
> used oracle 7. This is fine on the command line because
> I can set it in the shell environment. For cgi scripts,
> the problem is also solved by using apache SetEnv directive. However,
> this trick does not work under modperl. I had tried PerlSetEnv
> to no avail. The message is the same as if the LD_LIBRARY_PATH is not set:
> 
> install_driver(Oracle) failed: Can't load
> '/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Oracle/Oracle.so' for module 
>DBD::Oracle:
> libclntsh.so.8.0: cannot open shared object file: No such file or directory at
> /usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169. at (eval 27) line 3 
>Perhaps a required shared
> library or dll isn't installed where expected at /usr/local/apache/perl/tmp.pl line 
>11
> 
> Here is the section defining LD_LIBRARY_PATH under Apache::Registry:
> 
> PerlModule Apache::Registry
> Alias /perl/ /usr/local/apache/perl/
> 
>   PerlSetEnv LD_LIBRARY_PATH /u01/app/oracle/product/8.1.6/lib
>   SetHandler perl-script
>   PerlHandler Apache::Registry
>   Options ExecCGI
>   PerlSendHeader On
>   allow from all
> 
> 
> Does anyone know why PerlSetEnv does not work in this case?
> How come SetEnv works for cgi scripts? What is the work around?
> 
> Thanks for any info.
> 
> Richard

-- 


Yann Ramin  [EMAIL PROTECTED]
Atrus Trivalie Productions  www.redshift.com/~yramin
Monterey High ITwww.montereyhigh.com
ICQ 46805627
AIM oddatrus
Marina, CA

IRM Developer   Network Toaster Developer
SNTS Developer  KLevel Developer

(yes, this .signature is way too big)

"All cats die.  Socrates is dead.  Therefore Socrates is a cat."
- The Logician

THE STORY OF CREATION

In the beginning there was data.  The data was without form and null,
and darkness was upon the face of the console; and the Spirit of IBM
was moving over the face of the market.  And DEC said, "Let there be
registers"; and there were registers.  And DEC saw that they carried;
and DEC seperated the data from the instructions.  DEC called the data
Stack, and the instructions they called Code.  And there was evening
and there was a maorning, one interrupt...
-- Rico Tudor

William Safire's Rules for Writers:

Remembe



Re: cgis and subrequests

2000-08-20 Thread Rick Myers

On Aug 20, 2000 at 19:38:53 -0700, Alex Menendez twiddled the keys to say:
> cgi scripts. the module uses lookup_uri() to generate a subrequest then
> calls  run() to output the actual contents of the file. the eagle book
> says that calling run() on a subrequest should automatically send the
> client the appropriate http headers and the document's body. However, I
> have found that this is not the case. The following code does not send
> http headers for both cgis and html docs. The body stuff is working fine
> but the headers are not being sent:
> 
> my $uri = $r->uri;
> unless(!$r->args) {
> $uri = $uri .'?'.$r->args;
> }
> my $subr = $r->lookup_uri($uri);
> if($r->dir_config('is_cgi')) {
> $subr->handler('cgi-script');
> } else {
> $subr->handler('server-parsed');
> }
> $subr->run();
> my $status = $subr->status;
> $r->print(&create_img_tag($file,$SCRIPT_ON,$status));
> return $status;
> 
> any ideas?

Yes. run() no longer sends headers (as far as I know). I don't know when
it was changed, but it pre-dates my experience. I've had the following
working just fine for close to a year now (or maybe my sense of time is
warped :).

  my $lookup = $r->lookup_uri( $uri );
  $r->send_http_header( 'text/html' );
  my $status = $lookup->run;
  $r->status( $status );

Rick Myers[EMAIL PROTECTED]

The Feynman Problem   1) Write down the problem.
Solving Algorithm 2) Think real hard.
  3) Write down the answer.



setting LD_LIBRARY_PATH via PerlSetEnv does not work

2000-08-20 Thread Richard Chen

This is a redhat linux 6.2 box with perl 5.005_03, Apache 1.3.12,
mod_perl 1.24, DBD::Oracle 1.06, DBI 1.14 and oracle 8.1.6. 
For some odd reason, in order to use DBI, I have to set 
LD_LIBRARY_PATH first. I don't think I needed to do this when I
used oracle 7. This is fine on the command line because 
I can set it in the shell environment. For cgi scripts, 
the problem is also solved by using apache SetEnv directive. However, 
this trick does not work under modperl. I had tried PerlSetEnv
to no avail. The message is the same as if the LD_LIBRARY_PATH is not set:

install_driver(Oracle) failed: Can't load
'/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Oracle/Oracle.so' for module 
DBD::Oracle:
libclntsh.so.8.0: cannot open shared object file: No such file or directory at
/usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169. at (eval 27) line 3 Perhaps 
a required shared
library or dll isn't installed where expected at /usr/local/apache/perl/tmp.pl line 11 

Here is the section defining LD_LIBRARY_PATH under Apache::Registry:

PerlModule Apache::Registry
Alias /perl/ /usr/local/apache/perl/

  PerlSetEnv LD_LIBRARY_PATH /u01/app/oracle/product/8.1.6/lib
  SetHandler perl-script
  PerlHandler Apache::Registry
  Options ExecCGI
  PerlSendHeader On
  allow from all


Does anyone know why PerlSetEnv does not work in this case?
How come SetEnv works for cgi scripts? What is the work around?

Thanks for any info.

Richard



cgis and subrequests

2000-08-20 Thread Alex Menendez

Hello, all

I have a module  that appends a line of stats sensitive information to
the bottom of html pages or
cgi scripts. the module uses lookup_uri() to generate a subrequest then
calls  run() to output the actual contents of the file. the eagle book
says that calling run() on a subrequest should automatically send the
client the appropriate http headers and the document's body. However, I
have found that this is not the case. The following code does not send
http headers for both cgis and html docs. The body stuff is working fine
but the headers are not being sent:

my $uri = $r->uri;
unless(!$r->args) {
$uri = $uri .'?'.$r->args;
}
my $subr = $r->lookup_uri($uri);
if($r->dir_config('is_cgi')) {
$subr->handler('cgi-script');
} else {
$subr->handler('server-parsed');
}
$subr->run();
my $status = $subr->status;
$r->print(&create_img_tag($file,$SCRIPT_ON,$status));
return $status;

any ideas?

BTW> &create_img_tag just returns a string.
-amen




filtering outgoing headers

2000-08-20 Thread Bill Moseley

Hi,

In the converted AuthCookie (AuthCookieURL?) that also handles sessions by
URL, I need a way to add the session back on the URL when Apache generates
a redirect to someplace within the site (e.g. when a request is for a
directory).

Currently, I'm registering a 301 and 302 ErrorDocument to prefix the
Location: header with the session ID.  I don't like this method as it
requires the ErrorDocument and prevents other ErrorDocument handlers, and
adds ugly configuration in httpd.conf.  And it won't work in CGI scripts
that just print a Location: header.

Is there a mod_perl solution to this problem without using an
ErrorDocument?  Could I override $r->send_http_header or would that not
work with internal Apache redirects?  Shooting in the dark, I tried to tie
*STDOUT in a fixup handler, but the PRINT method never gets called.  But
this isn't really a pipelined handler operation -- perhaps mod_perl ties
*STDOUT after the fixup handler?

It would be nice in mod_perl to be able to filter everything that's going
to the client -- even non-mod_perl generated responses in ways other than
using pipelined PerlHandlers.

Anyway, I'm searching for suggestions as at this point I'm just guessing...

Thanks,




Bill Moseley
mailto:[EMAIL PROTECTED]



Re: Centralized Caching

2000-08-20 Thread Dave Rolsky

On Sun, 20 Aug 2000, Angela Focazio wrote:

> It seems very inefficient on memory to have each child process forms
> its own cache, so I was interested in creating a centralized cache that
> all of the child processes could dip into (actually forming a module
> that allows for I/O & control of a centralized cache - expiring
> information, delegating a maximum size to different structures, you get
> the clue). Has anyone had luck with this? And if so, did having a single
> cache slow down access speeds? I messed around a good bit, but haven't
> found a way to get it to work.

I did briefly try this out and found that large IPC caches tended to be
very slow.  I didn't experiment with another cache mechanism.

I do have a potentially interesting cache module as part of my Alzabo
project (a perl data modelling tool & RDBMS-OO mapper) that caches data
inside an individual process but uses IPC to control expiration of the
data between multiple processes.  Its called Alzabo::ObjectCacheIPC in the
modules.  Its got a fairly generic interface and could be used outisde
Alzabo.  Alzabo is at alzabo.sourceforge.net

-dave

/*==
www.urth.org
We await the New Sun
==*/




Re: expiring pages with mod_perl

2000-08-20 Thread Ken Williams

[EMAIL PROTECTED] (Jamie Krasnoo) wrote:
>Sorry for the newbie question but could anyone tell me how to expire pages
>so a user can't use the back button to get back to that page?
>

Check this out:

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

Short answer: $r->no_cache(1);






Re: expiring pages with mod_perl

2000-08-20 Thread T.J. Mather

use

my $headers = $r->headers_out;
$headers->{'Pragma'} = $headers->{'Cache-control'} = 'no-cache';
$r->no_cache(1);

for more information see
http://perl.apache.org/guide/correct_headers.html#2_1_3_Expires_and_Cache_Control

On Sun, 20 Aug 2000, Jamie Krasnoo wrote:

> Sorry for the newbie question but could anyone tell me how to expire pages
> so a user can't use the back button to get back to that page?
> 
> 
> Thanks,
> Jamie
> 




Re: expiring pages with mod_perl

2000-08-20 Thread Matt Sergeant

On Sun, 20 Aug 2000, Jamie Krasnoo wrote:

> Sorry for the newbie question but could anyone tell me how to expire pages
> so a user can't use the back button to get back to that page?

Besides being a really bad idea, and next to impossible to implement, this
is not a mod_perl question, but a HTML/HTTP question. Once you've figured
those bits out you just need $r->header_out(), but its going to be much
harder than that.

-- 


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




expiring pages with mod_perl

2000-08-20 Thread Jamie Krasnoo

Sorry for the newbie question but could anyone tell me how to expire pages
so a user can't use the back button to get back to that page?


Thanks,
Jamie




Re: Centralized Caching

2000-08-20 Thread T.J. Mather

You might want to look into IPC::SharedCache or IPC::Shareable.  These
modules cache variables in shared memory.




Re: Centralized Caching

2000-08-20 Thread Perrin Harkins

Angela Focazio wrote:
> 
> It seems very inefficient on memory to have each child process forms
> its own cache, so I was interested in creating a centralized cache that
> all of the child processes could dip into (actually forming a module
> that allows for I/O & control of a centralized cache - expiring
> information, delegating a maximum size to different structures, you get
> the clue). Has anyone had luck with this?

There are several modules that do things like this on CPAN.  If none of
those meets your needs, you might try building one on the shared memeory
hash structure provided by IPC::MM or use BerkeleyDB (not DB_File) which
also allows for shared memeory with multiple readers/writers.

- Perrin



ANNOUNCE: HTML::Embperl 1.3b5 (pre 1.3)

2000-08-20 Thread Gerald Richter

The URL

ftp://ftp.dev.ecos.de/pub/perl/embperl/HTML-Embperl-1.3b5.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/G/GR/GRICHTER/HTML-Embperl-1.3b5.tar.gz
  size: 282226 bytes
   md5: 812c620f5123b91c74b0c46a24d573d0


Embperl is a module for embedding Perl code in HTML pages. See
http://perl.apache.org/embperl/ (english) or http://www.ecos.de/embperl/
(german) for more informations.

The next release of Embperl should be the final 1.3 release. So give this
beta a try and tell me if you find any problems with it.

Enjoy

Gerald

Changes since 1.3b4:

   - Embperl now supports Apache::Session 1.52. See "Session handling"
 in the docs, how the setup has changed.
   - Fixed a problem with POSTed data, which had got lost for the first,
 request when using EmbperlObject handler. Spotted by
 Kaare Rasmussen.
   - Fixed a typo in HTML::Embperl::Mail, spotted by Robert.
   - changed require to use HTML::Embperl in EmbperlObject to avoid problems
 with dynamic loading. Spotted by Robert.
   - Embperl takes the cookie for session handling from the Apache
 request record to make it available in earlier phases then the
 content handler. Suggested by Jack Cushman.
   - added entity decoding for value attribute of radio/checkboxes.
 Spotted by Chris Thorman.
   - %fdat is not resetup when already done and formtype is
 multipart/formdata. Spotted by Michael Slade.
   - Embperl inserts & instead of a signle & inside query strings
 when expaned from array or hash refs.
   - Embperl now also accepts hashref inside a url and expand it
 to a query_string i.e.  will
become
 .
   - EMBPERL_COOKIE_EXPIRES now also supports relativ times like:
 +30s +10m +1h -1d +3M +10y
   - $req_rec -> pnotes ('EMBPERL_ERRORS') could be used to retrieve
 error message inside a error document
   - make Embperl compile and run with threaded Perl 5.6. With help
 from Jason Bodnar. NOTE: That doesn't mean that Embperl is
 threadsafe!


-
Gerald Richterecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:   Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151
WWW:http://www.ecos.de  Fax:  +49 6133 925152
-





Centralized Caching

2000-08-20 Thread Angela Focazio



It seems very inefficient on memory to have each child process forms
its own cache, so I was interested in creating a centralized cache that
all of the child processes could dip into (actually forming a module
that allows for I/O & control of a centralized cache - expiring
information, delegating a maximum size to different structures, you get
the clue). Has anyone had luck with this? And if so, did having a single
cache slow down access speeds? I messed around a good bit, but haven't
found a way to get it to work.

Thanks SO much! This has been slowing eating up my brain trying to
think about how to do it!

Terry Moran




Apache::Perfmon 0.011

2000-08-20 Thread Lupe Christoph

Thanks to Balazs Rauznitz <[EMAIL PROTECTED]> for pointing
out an embarrasing thinko. The corrected version is at

http://free.prohosting.com/~lupe/Personal/Perl/Apache-Perfmon/Apache-Perfmon-0.011.tar.gz

Sorry if you already grabbed this.
Lupe Christoph
-- 
| [EMAIL PROTECTED]   |http://free.prohosting.com/~lupe |
| "jryy vg ybbxf yvxr gur l2x oht qvqa'g erne vg'f htyl urnq." "lrc. gur |
| qbbzfnlref unir orra cebira jebat lrg ntnva."    "qvq lbh frr gung |
| gbb?" "ubhfgba. jr unir n ceboyrz."   User Friendly 2000-01-01 |



Re: Do you use iServer?

2000-08-20 Thread Alex Shnitman

On Sat, Aug 19, 2000 at 03:22:32PM -0400, Ron Pero wrote:

> Do you use mod_perl at iServer?

I've used them for some time. Indeed there are some problems with
their setup. What have you encountered?

--Alex



Module proposal - Apache::Perfmon

2000-08-20 Thread Lupe Christoph

Hello!

Since I recently faced the question where a complex Apache
installation spent it's time, I wrote alittle handler pair
that logs the cpu (user/system) and realtime taken by a request.

I'm proposing to name this Apache::Perfmon, and will add it to
CPAN if the more knowledgable mod_perl people have no objections.
You can download it from my private webpage for now. The
Prohosting people seem to have broken a few things with SSI
and CGI, but plain downloading works.
 
http://free.prohosting.com/~lupe/Personal/Perl/Apache-Perfmon/Apache-Perfmon-0.01.tar.gz

Below you find the README, with (hopefully) a sufficient
description of how this simple thingy works.

Lupe Christoph

Apache::Perfmon
  Description

Apache::Perfmon allows monitoring the cpu and realtime used by an apache
server to service requests. It is inserted as a handler in the very
first request phase (the PostReadRequest phase) and the very last phase
(the Cleanup phase).

It samples the user and system CPU time taken by the apache subprocess
and the realtime at those processing points and prints the differences
to a logfile. Note that there is a small overhead not included in these
times.

  Copying

Copyright (c) 2000 Lupe Christoph. All rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

  Download

You can download Apache::Perfmon from my website at
http://free.prohosting.com/~lupe/Personal/Perl/Apache-Perfmon/ .

  Prerequisites

perl 5.005_03  While it is quite possible that this module will work
   with earlier versions, it has only been tested with this
   version.

Apache webserver with mod_perl
   The module has been tested with *Apache/1.3.12 (Unix)
   mod_perl/1.24*.

  Build/Installation

Standard build/installation supported by ExtUtils::MakeMaker(3)...

perl Makefile.PL
make
make test
make install

  Author

Lupe Christoph <[EMAIL PROTECTED]>

  Webpage

Apache::Perfmon has it's own webpage at
http://free.prohosting.com/~lupe/Personal/Perl/Apache-Perfmon/ .


-- 
| [EMAIL PROTECTED]   |http://free.prohosting.com/~lupe |
| "jryy vg ybbxf yvxr gur l2x oht qvqa'g erne vg'f htyl urnq." "lrc. gur |
| qbbzfnlref unir orra cebira jebat lrg ntnva."    "qvq lbh frr gung |
| gbb?" "ubhfgba. jr unir n ceboyrz."   User Friendly 2000-01-01 |



Re: Milage may vary comments

2000-08-20 Thread George Sanderson

>> 2) 'Do not': "PerlFreshRestart On" in httpd.conf.
>
>Curiously enough, "PerlFreshRestart On" has always worked for me, even
>on the production servers.
>
>It's pretty damn useful too, giving servers a graceful restart everytime
>you upload a module...  it'd be a pain to have to fully restart the
>server every time, that would mean like 10 seconds of downtime for the
>whole site.
>
I should be more observant, because I think this problem ("PerlFreshRestart
On") may be related to my latest email posting "SIGHUP failure".  Perhaps
if I solve it, the solution to this problem will follow. Hopefully, someone
will respond.  It just seems like it's one think after another.  

Perhaps as my skills improve, it will become easier to get more difficult!





Re: PerlAuthenHandler -- doesn't get there...? SOLVED

2000-08-20 Thread Stas Bekman

> SO -- Stas, here's a coupla extra tweaks i think you should
> make so that cut/paste newbies (unlike me, of course) will
> have an easier time with this particular example on the next
> iteration:

It's corrected in the guide's cvs version! Thanks Will!

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