RE: Embedded Perl XML Extensions ...

2000-02-12 Thread Gerald Richter


 The idea is to apply the stylesheet transformations specified by
 an XSL document to everything below a node (possibly the root)
 of another XML document.  For now it looks like the only XSLT
 transformer in perl is at:
  http://www.sci.kun.nl/sigma/Persoonlijk/egonw/xslt/

 There are some samples of the kinds of things you can do at
 http://msdn.microsoft.com/downloads/samples/internet/xml/multiple_
 views/default.asp
 although they are somewhat MicroSoft-centric in that they apply the
 transformation inside the browser (and only work with IE).  What we
 need is the ability to detect the browser type and render to
 HTML on the server if the browser can't do it.  The only things
 I've seen so far that can do this besides IIS have been in Java.


What I have currently in mind, will be able to do this, but I will not
implement an XLST transformer on my own, so you have to plug in another
module which does the actual transformation. (There are plans on
xml.apache.org to implement an C++ Version of their XLST transformer with a
Perl interface. If they do so this could be a possibility)

Gerald



Question about SendFile.pm from Eagle book

2000-02-12 Thread LSMPX

As a beginner in Mod_perl,
I have to get the file from the remote host (Mod_perl enabled Apache)
if not in the local host, so I am currently modifying SendFile.pm in Eagle 
book
at
 unless(-e $r-finfo) {
 ...
 instead of giving the nonexistence error message here
 get the file from the remote host ( I assume the file exist there)
 by connecting to the remote host using Socket here 
 ...
}
 
But I have difficulties in setting up Socket connection to the remote.
Can I use just simple Perl Socket here (IO::Socket) ?

Thank you all. 



Re: Apache::ASP HTTP's validation model

2000-02-12 Thread Aaron Ross

hi Dmitry!

 Wouldn't it be great it someone came up with a general solution for this...
some kind of logical class from which you could inherit and implement the
necessary methods. 

 There was an interesting thread about this problem with Mason. I'm sure it's 
come up before with ASP. The mod_perl guide has a great section on it.. so
what's missing for a mod_perl handler? what would it take to make a general 
solution... Well a general framework. Is that even possible?

 Just Curious,
Aaron

 (Joshua, promise to let me know when you get tired of my "ideas" and I'll 
 stop :-)
 
 No, this wouldn't make sense for most scripts which will
 contain dynamic parts.
 
 What about a situation when the content is been dynamically generated from 
 a source that doesn't change often, but in an unpredictable fashion (e.g. a 
 guest book or such)?  I realize that it impossible for ASP itself to know 
 when the actual source has been changed, but it should be able to make an 
 educated guess with some help from the author.
 
 My original thought was to have a way to define file dependencies for an 
 .asp file.  If any of these files has an mtime greater then 
 'If-Modified-Since,' then the .asp file gets processed, otherwise, the 
 client gets NOT_MODIFIED.  Then I realized that the datasource may not 
 necessarily be a file.  The data could be coming from a database, from 
 another web server, etc., so a more general mtime discovery mechanism would 
 be needed.  (perhaps a callback into the script?)
 
 Any thoughts?
 
 Regards
 Dmitry



Re: Question about SendFile.pm from Eagle book

2000-02-12 Thread Frank Wiles

On Sat, 12 Feb 2000 [EMAIL PROTECTED] wrote:

 As a beginner in Mod_perl,
 I have to get the file from the remote host (Mod_perl enabled Apache)
 if not in the local host, so I am currently modifying SendFile.pm in Eagle 
 book
 at
  unless(-e $r-finfo) {
  ...
  instead of giving the nonexistence error message here
  get the file from the remote host ( I assume the file exist there)
  by connecting to the remote host using Socket here 
  ...
 }
  
 But I have difficulties in setting up Socket connection to the remote.
 Can I use just simple Perl Socket here (IO::Socket) ?

  Are you trying to get a file via HTTP? If so check out the
LWP::lwpwww-5.47 module at CPAN.  It will handle and the socket
connections for you and reduce retrieveing a file to "get($URL);".  

  Note I haven't attempted to use this in a mod_perl setting, but I can't
imagine any reason why it shouldn't work. 

 ---
  Frank Wiles [EMAIL PROTECTED]
  http://frank.wiles.org
 ---




Can't upgrade that kind of scalar

2000-02-12 Thread Ed Loehr

Aside from gdb, any fishing tips on how to track this fatal problem
down?

Can't upgrade that kind of scalar at XXX line NN...

Happens intermittently, often on a call to one of these (maybe the
first access of $r?):

$r-server-server_hostname()
$r-connection-remote_ip()

I've tried turning off PerlFreshRestart, have _totally_ clean output
from 'use diagnostics', reviewed The Guide, 'perldoc perldiag', FAQ,
deja.com, swarthmore, removed /o, used Carp::cluck, handled global
vars with 'use vars qw(...)'...

Config:  apache 1.3.9, mod_perl 1.21, mod_ssl 2.4.9, openssl 0.9.4,
perl 5.005_03, DBI 1.13 (no Apache::DBI), DBD::Pg 0.92, Linux
2.2.12-20smp (RH 6.1)...



END blocks in perl modules

2000-02-12 Thread Ilya Obshadko

Hello modperl,

  Yet another mystic thing. I've been messing around with
  IPC::Shareable. The purpose was just simple: create shared memory
  segment on startup, give access to it for all child processes,
  destroy this segment after httpd shutdown. I've encountered a
  strange problem with the last action. I did not understand what's
  going on until I've printed PIDs that execute cleanup to STDERR.
  Then I found that END block IS NOT BEING EXECUTED BY PARENT
  HTTPD PROCESS. Of course httpd child, that is executed with ordinary
  user privileges, cannot destrroy shm object owned by root :(

  Question 2 all, (and especially to Doug): was this behaviour
  implemented 'on purpose', or it is just 'undocumented feature'? ;)

Best regards,
 Ilya  mailto:[EMAIL PROTECTED]




Re: END blocks in perl modules

2000-02-12 Thread James G Smith

Ilya Obshadko [EMAIL PROTECTED] wrote:
Hello modperl,

  Yet another mystic thing. I've been messing around with
  IPC::Shareable. The purpose was just simple: create shared memory
  segment on startup, give access to it for all child processes,
  destroy this segment after httpd shutdown. I've encountered a
  strange problem with the last action. I did not understand what's
  going on until I've printed PIDs that execute cleanup to STDERR.
  Then I found that END block IS NOT BEING EXECUTED BY PARENT
  HTTPD PROCESS. Of course httpd child, that is executed with ordinary
  user privileges, cannot destrroy shm object owned by root :(

What you want to do, I think, is something like the following:

  sub tie_keys {
unless(tied %Keys or not defined $IPC::Shareable::VERSION) {
  tie(%Keys, 'IPC::Shareable', 'abcd', {  # random glue...
  mode = 0600,  # a bit more secure
  destroy = 'no',
  exclusive = 'no',
  create = 'yes',
});
}
  }

  if(defined $Apache::VERSION) {
Apache-push_handlers(PerlChildInitHandler = \tie_keys);
  } else {
tie_keys; # we're not in mod_perl
  }

When the child cleans up and dies, the hash will be untied.  You can't do the tieing 
or shared memory creation in the module initialization since the server is running as 
root at that point, but nolonger when the child comes along and needs to tie to the 
shared memory.

This will not clean up the shared memory when all the children die, since the 
`destroy' attribute is set to `no'.  If I read the docs correctly, setting it to `yes' 
will cause the shared memory to be deleted with the creating process closes the 
segment.  The above code will reuse the shared memory segment across server restarts.

Whether or not the destruction of the shared memory can be done in the END block, I 
don't think it can, but Doug would probably be authoritative on that.
-- 
James Smith [EMAIL PROTECTED], 409-862-3725
Texas AM CIS Operating Systems Group, Unix




Re[2]: END blocks in perl modules

2000-02-12 Thread Ilya Obshadko

Hello James,

ñóááîòà, 12 ôåâðàëÿ 2000 ã., you wrote:

JGS What you want to do, I think, is something like the following:

JGS   sub tie_keys {
JGS unless(tied %Keys or not defined $IPC::Shareable::VERSION) {
JGS   tie(%Keys, 'IPC::Shareable', 'abcd', {  # random glue...
JGS   mode = 0600,  # a bit more secure
JGS   destroy = 'no',
JGS   exclusive = 'no',
JGS   create = 'yes',
JGS });
JGS }
JGS   }

My point was NOT to tie separately in each child, but execute tie()
once during startup. The code of module that is being loaded
from startup.pl looks like this:

BEGIN {
use IPC::Shareable;
tie %RADDR_CACHE, 
'IPC::Shareable',
{ key = 'href', mode = 0666, create = 1 };
}

[bla-bla-bla]

END {
untie %RADDR_CACHE;
}

It works fine for me, i.e. all children has a proper access to
segment, can read  write all that I need and so on.
But if I tie() with { destroy = 1 }, segment is being destroyed in
approximately 10 seconds after httpd startup (seems like httpd
parent restarts itself after initialization). So I've tried to destroy
segment manually and then found that END {} is not executed during
parent shutdown...

Actually, that is not a REAL problem, because httpd is running already
and garbage collector is on its way ;)

Best regards,
 Ilyamailto:[EMAIL PROTECTED]