Re: [PATCH] in memory $Application object for Apache::ASP

2000-03-29 Thread Joshua Chamas

Joel Reed wrote:
 
 this may be a dumb patch to Apache::ASP (at least it is my first).
 
 Rationale:
 
 i have the following issues with the current implementation of $Application
 
 1. everything you store in $Application-{foo} must be
 serializable my MLDBM. (right?) i have SWIG'd c++ classes for
 which this will not work.
 
 2. limitation #1 seems to limit Apache:ASP's usefulness as a
 cross-platform solution to ActivePerl/IIS/ASP scripts you
 want to move to linux, etc. i want to do this - not sure if
 this is really a key thing for joshua though...
 ...

What you are talking about is just a global that you access
in your scripts.  You could declare this in your global.asa
with 

  use vars qw($Application2);

Then just use it like $Application2-{key} = $value;

I use this kind of in process data caching all the time,
and you will see that Apache::DBI does something similar.

What you don't get here is interprocess communication
which is what the use of $Application is geared for, that
the data is stored is some process neutral location, so
web requests may access the data independent of the httpd 
process they are coming from.

--Joshua

_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks  free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Re: [PATCH] in memory $Application object for Apache::ASP

2000-03-29 Thread Joel Reed

On Mar 29, [EMAIL PROTECTED] hacked the bitstream to say...
Joshua Joel Reed wrote:
Joshua  
Joshua  this may be a dumb patch to Apache::ASP (at least it is my first).
Joshua  
Joshua  Rationale:
Joshua  
Joshua  i have the following issues with the current implementation of $Application
Joshua  
Joshua  1. everything you store in $Application-{foo} must be
Joshua  serializable my MLDBM. (right?) i have SWIG'd c++ classes for
Joshua  which this will not work.
Joshua  
Joshua  2. limitation #1 seems to limit Apache:ASP's usefulness as a
Joshua  cross-platform solution to ActivePerl/IIS/ASP scripts you
Joshua  want to move to linux, etc. i want to do this - not sure if
Joshua  this is really a key thing for joshua though...
Joshua  ...
Joshua 
Joshua What you are talking about is just a global that you access
Joshua in your scripts.  You could declare this in your global.asa
Joshua with 
Joshua 
Joshua   use vars qw($Application2);
Joshua 
Joshua Then just use it like $Application2-{key} = $value;
Joshua 
Joshua I use this kind of in process data caching all the time,
Joshua and you will see that Apache::DBI does something similar.

only then i don't have API consistency from NT/iis/asp... maybe
this is a unreasonable goal of mine... :(

Joshua 
Joshua What you don't get here is interprocess communication
Joshua which is what the use of $Application is geared for, that
Joshua the data is stored is some process neutral location, so
Joshua web requests may access the data independent of the httpd 
Joshua process they are coming from.
Joshua 

yes this is the killer with making my stuff work for both iis/asp  modperl.
do you have any suggestions for an api consistent solution? maybe i could
hack up something where $Application data was obtainable thru IPC? the
killer is the serialization requirement as i'm dealing with perl encapsulated
c++ objects... 

thanks for your feedback,
jr

-- 

Joel W. Reed  http://ruby.ddiworld.com/jreed
---A few cans short of a six pack, Six short.---





Re: [PATCH] in memory $Application object for Apache::ASP

2000-03-29 Thread Joel Reed

On Mar 29, [EMAIL PROTECTED] hacked the bitstream to say...
modperl Joshua What you don't get here is interprocess communication
modperl Joshua which is what the use of $Application is geared for, that
modperl Joshua the data is stored is some process neutral location, so
modperl Joshua web requests may access the data independent of the httpd 
modperl Joshua process they are coming from.
modperl Joshua 
modperl 
modperl yes this is the killer with making my stuff work for both iis/asp  modperl.
modperl do you have any suggestions for an api consistent solution? maybe i could
modperl hack up something where $Application data was obtainable thru IPC? the
modperl killer is the serialization requirement as i'm dealing with perl encapsulated
modperl c++ objects... 

sorry to respond to myself but i just realized a got momentarily confused.
what i would love to have is

api consistent (w/ IIS/ASP) means of all scripts served by apache
process "foo" to be able to access the $Application data and that
this data doesn't have a must-be-serializable requirement.

Apache::ASP currently provides

$Application data thru MLDBM serialization that is available
to ALL apache processes. 

i could imagine at least some people porting IIS/ASP/ActivePerlScript
applications to apache/mod_perl would appreciate someway to do what
i'm trying to do.

under IIS lots of folks make COM objects, stuff them in $Application
and all the IIS threads use the $App data just fine. when these folks
port to apache/linux use must drop COM (thus i'm wrapping straight C++
libraries into Perl objects with SWIG), but i still need this can't-require
serialization-support for $Application data requirement and would gladly
accept each process having its own $Application data.

what about a configuration option that was something like...

PerlSetVar AppDataPerProcess (0|1)

jr

-- 

Joel W. Reed  http://ruby.ddiworld.com/jreed
"This is a job for.. AACK! WAAUGHHH!! ...someone else." - Calvin





Re: [PATCH] in memory $Application object for Apache::ASP

2000-03-29 Thread Joshua Chamas

Joel Reed wrote:
 
 modperl yes this is the killer with making my stuff work for both iis/asp  modperl.
 modperl do you have any suggestions for an api consistent solution? maybe i could
 modperl hack up something where $Application data was obtainable thru IPC? the
 modperl killer is the serialization requirement as i'm dealing with perl 
encapsulated
 modperl c++ objects...
 
 sorry to respond to myself but i just realized a got momentarily confused.
 what i would love to have is
 
 api consistent (w/ IIS/ASP) means of all scripts served by apache
 process "foo" to be able to access the $Application data and that
 this data doesn't have a must-be-serializable requirement.
 
 Apache::ASP currently provides
 

To really have a consistent API, Apache + mod_perl will have
to go multi-threaded.  Or you can turn off $Application with
AllowApplicationState 0 as I suggested in the last mail, and 
run your Apache web server with MaxClients 1, and put a proxy
in front of it.  I wouldn't advise it, but its a possibility.

Note that if you do go the route of disabling $Application
and such, you will lose access to the events Application_OnStart 
 Application_OnEnd

-- Joshua
_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks  free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



[PATCH] in memory $Application object for Apache::ASP

2000-03-28 Thread Joel Reed

this may be a dumb patch to Apache::ASP (at least it is my first).

Rationale:

i have the following issues with the current implementation of $Application

1. everything you store in $Application-{foo} must be 
serializable my MLDBM. (right?) i have SWIG'd c++ classes for
which this will not work.

2. limitation #1 seems to limit Apache:ASP's usefulness as a
cross-platform solution to ActivePerl/IIS/ASP scripts you 
want to move to linux, etc. i want to do this - not sure if
this is really a key thing for joshua though...

So the following patch (which i really hope joshua comments on ;)
fixes my problems (or so it seems). i've made an $Application2 object
which uses the implementation from the mod_perl guide to make a
global variable accessible by all scripts. (i'd love for this to become
the real $Application). It doesn't do everything else $Application
does at this point, but does demonstrate the idea  works on my SWIG'd 
c++ stuff.

i'd love to know if i'm totally of the wall or how to improve this
idea. seems like it would be faster, more like IIS/ASP, and remove
the serializable requirement, although it would jack up memory 
requirements i would imagine. i'd be glad to incorporate any suggested
improvements to make it acceptable to Joshua for inclusion in
Apache::ASP...

--- ASP.pm  Thu Feb  3 20:35:08 2000
+++ /usr/lib/perl5/site_perl/5.005/Apache/ASP.pmTue Mar 28 16:00:19 2000
@@ -1154,6 +1154,8 @@
 # "use vars qw(\$".join(" \$",@Apache::ASP::Objects).');',
   "sub $subid { ",
   ' return(1) unless $_[0]; ', #@_ = ();',
+  "use vars qw(%Application2);",
+  "*Application2 = \\%Apache::ASP::InMemoryApplicationObject::Application2;",
   $$script,
   '}',
  );
@@ -2115,6 +2117,8 @@
 $strict,
 "use vars qw(\$".join(" \$",@Apache::ASP::Objects).');',
 "use lib qw($self-{asp}-{global});",
+"use vars qw(%Application2);",
+"*Application2 = 
+\\%Apache::ASP::InMemoryApplicationObject::Application2;",
 $code,
 'sub exit { $main::Response-End(); } ',
 '1;',
@@ -4464,6 +4468,13 @@
 
 sub connection { shift; }
 
+1;
+
+package Apache::ASP::InMemoryApplicationObject;
+use strict;
+use vars qw(%Application2);
+%Application2 = (
+);
 1;
 
 __END__


-- 

Joel W. Reed  http://ruby.ddiworld.com/jreed
Daddy, why doesn't this magnet pick up this floppy disk?