Re: Apache::ASP #include virtual loses variables

2000-05-21 Thread Joshua Chamas

Ime Smits wrote:
 
 | Well, I would like to suggest that you consider including !--#include
 | virtual-- in the Apache::ASP distribution, so that included files use the
 | same namespace. It doesn't make sense logically that include virtual
 | behaves differently from include file (other than the way the
 | filename/pathname is interpreted, of course).
 
 It does make sense to me, though. Consider one having very big (say 50k)
 include files being included from several other (say 100) scripts. Just
 sucking them in each script doing the include would cause *every* script
 growing by at least the size of the include. Now as Apache::ASP caches all
 compiled scripts, this would result in each httpd process growing by 50kB x
 100 scripts = 5 MB, holding 98% redundant data.
 

If DynamicIncludes are turned on, then file includes are 
compiled as subroutines, and executed as if $Response-Include()
were called.  Without this setting, includes text are added
to the including scripts like you are saying.

But this does not solve the virtual includes problem.  A virtual
include is supposed to be anything executed on the server, 
not just files, but the output from anything like some C cgi, 
or another .pl or so, and must therefore be processed as a 
separate subrequest.  This is what Apache::SSI does.

The problem here is that there is no way for the Apache::ASP 
script to catch the output from the apache subrequest to 
even try to compile it into its own script, even if you really
wanted to do this.  So this is why this is stays a separate
feature to be handled by Apache::SSI, that it doesn't help
at all to inline it into Apache::ASP, except some small
performance benefit by not running the output through 
Apache::Filter

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



Re: Apache::ASP #include virtual loses variables

2000-05-21 Thread Philip Mak

So, there's no way in Apache::ASP to include a file by specifying a path
relative to DOCUMENT_ROOT, or relative to the directory of the current
file (which is not necessarily equivalent to the request URI, if the
current file is included)?

I managed to get my site to work using !--#include file-- and specifying
full pathnames and using PerlSetVar IncludesDir, but it would have been
nice if there was a way to include a file with relative path
specifications as in the above paragraph (and still be in the same
namespace). I first learned ASP on IIS, and there, !--#include virtual--
(which allows the relative path specifications) can be used for this
purpose.

-Philip Mak ([EMAIL PROTECTED])

On Sat, 20 May 2000, Joshua Chamas wrote:

 Ime Smits wrote:
  
  | Well, I would like to suggest that you consider including !--#include
  | virtual-- in the Apache::ASP distribution, so that included files use the
  | same namespace. It doesn't make sense logically that include virtual
  | behaves differently from include file (other than the way the
  | filename/pathname is interpreted, of course).
  
  It does make sense to me, though. Consider one having very big (say 50k)
  include files being included from several other (say 100) scripts. Just
  sucking them in each script doing the include would cause *every* script
  growing by at least the size of the include. Now as Apache::ASP caches all
  compiled scripts, this would result in each httpd process growing by 50kB x
  100 scripts = 5 MB, holding 98% redundant data.
  
 
 If DynamicIncludes are turned on, then file includes are 
 compiled as subroutines, and executed as if $Response-Include()
 were called.  Without this setting, includes text are added
 to the including scripts like you are saying.
 
 But this does not solve the virtual includes problem.  A virtual
 include is supposed to be anything executed on the server, 
 not just files, but the output from anything like some C cgi, 
 or another .pl or so, and must therefore be processed as a 
 separate subrequest.  This is what Apache::SSI does.
 
 The problem here is that there is no way for the Apache::ASP 
 script to catch the output from the apache subrequest to 
 even try to compile it into its own script, even if you really
 wanted to do this.  So this is why this is stays a separate
 feature to be handled by Apache::SSI, that it doesn't help
 at all to inline it into Apache::ASP, except some small
 performance benefit by not running the output through 
 Apache::Filter
 
 -- Joshua
 _
 Joshua Chamas Chamas Enterprises Inc.
 NodeWorks  free web link monitoring Huntington Beach, CA  USA 
 http://www.nodeworks.com1-714-625-4051
 




Re: Apache::ASP #include virtual loses variables

2000-05-21 Thread Joshua Chamas

Philip Mak wrote:
 
 So, there's no way in Apache::ASP to include a file by specifying a path
 relative to DOCUMENT_ROOT, or relative to the directory of the current
 file (which is not necessarily equivalent to the request URI, if the
 current file is included)?
 
 I managed to get my site to work using !--#include file-- and specifying
 full pathnames and using PerlSetVar IncludesDir, but it would have been
 nice if there was a way to include a file with relative path

!--#include file= -- allows relative file specifications.
Did it not work for you for some reason?

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



Re: Apache::ASP #include virtual loses variables

2000-05-20 Thread Joshua Chamas

Use file includes.  virtual includes are meant to execute
anything and include its output, and is handles by Apache::SSI
outside of Apache::ASP. File includes will be executed as perl 
asp subroutines in the same perl namespace as the 
including script.

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

Philip Mak wrote:
 
 Hello,
 
 I have stumbled upon an issue with Apache::ASP !--#include virtual--
 directive. Included files do not seem to be able to access the same scope
 of variables. I am using the following test program:
 
 File 1.inc:
 
 !--#include virtual="2.inc"--
 % $test .= '1'; %
 p$test = %=$test%/p
 
 File 2.inc:
 
 % $test = '2'; %
 
 One would expect the output to be "$test = 21", but it comes out as
 "$test = 1". I have tried the same thing with #include file instead of
 #include virtual and the result is correct.
 
 I am using Apache/1.3.9 on Red Hat Linux. My httpd.conf is setup for ASP
 as follows:
 
 Files ~ (\.inc)
 SetHandler perl-script
 PerlSetVar Global /tmp
 PerlSetVar Filter On
 PerlHandler Apache::ASP Apache::SSI
 /Files
 
 Does anyone know if this is a bug, or a feature, or did I perhaps setup
 ASP incorrectly? Is there a good workaround for this? (It is inconvenient
 for me to use #include file instead since I need to include files relevant
 to DOCUMENT_ROOT, as well as relevant to the location of the current file,
 but I could use that as a last resort.)
 
 Thanks,
 
 -Philip Mak ([EMAIL PROTECTED])



Re: Apache::ASP #include virtual loses variables

2000-05-20 Thread Philip Mak

On Sat, 20 May 2000, Joshua Chamas wrote:

 Use file includes.  virtual includes are meant to execute
 anything and include its output, and is handles by Apache::SSI
 outside of Apache::ASP. File includes will be executed as perl 
 asp subroutines in the same perl namespace as the 
 including script.

I see. There are two problems that I have with file includes though:

(1) I cannot specify a file's location relative to $ENV{'DOCUMENT_ROOT'}.

(2) I cannot specify a file's location relative to the directory the
current file is in.

For #1, I want to do something like this in all my pages:

!--#include virtual="/code/header.asp"--
!--#include virtual="/code/footer.asp"--

And for #2, I have an "index.inc" in all my directories. Each index.inc
has to include the one in its parent directory, e.g.:

!--#include file="../index.inc"--

so that directories can pass on properties to their subdirectories. If I
use include file for that, it will include files relative to the pathname
of the first ASP file, and not relative to the pathname of the ASP file
that actually has the include.

One reason I'm coding like this is because I want to give each directory a
title and append it to the page's title. e.g.:

http://www.girlsofanime.com/series/slayers/lina/ has title of
Girls of Anime::Anime Series::The Slayers::Lina Inverse

The way the title is constructed is:

In /index.inc: $title = 'Girls of Anime';
/series/index.inc: $title .= '::Anime Series';
/series/slayers/index.inc: $title .= '::The Slayers';
/series/slayers/lina/index.inc: $title .= '::Lina Inverse';

Is there a better way I can do this? Right now I'm thinking of either
trying to hack Apache::ASP to support #include virtual, or using absolute
pathnames or trying to put $ENV{'DOCUMENT_ROOT'} in the file path.

-Philip Mak ([EMAIL PROTECTED])




Re: Apache::ASP #include virtual loses variables

2000-05-20 Thread Joshua Chamas

Philip Mak wrote:
 
 I see. There are two problems that I have with file includes though:
 
 (1) I cannot specify a file's location relative to $ENV{'DOCUMENT_ROOT'}.
 
 (2) I cannot specify a file's location relative to the directory the
 current file is in.
 
 For #1, I want to do something like this in all my pages:
 
 !--#include virtual="/code/header.asp"--
 !--#include virtual="/code/footer.asp"--
 

For #1, know includes will be picked up from your Global directory,
so you can use that repository to share includes, instead of some
DOCUMENT_ROOT location.  You can also use IncludesDir for this if
it is set.

 And for #2, I have an "index.inc" in all my directories. Each index.inc
 has to include the one in its parent directory, e.g.:
 
 !--#include file="../index.inc"--
 
 so that directories can pass on properties to their subdirectories. If I
 use include file for that, it will include files relative to the pathname
 of the first ASP file, and not relative to the pathname of the ASP file
 that actually has the include.
 
 ...
 http://www.girlsofanime.com/series/slayers/lina/ has title of
 Girls of Anime::Anime Series::The Slayers::Lina Inverse
 
 The way the title is constructed is:
 
 In /index.inc: $title = 'Girls of Anime';
 /series/index.inc: $title .= '::Anime Series';
 /series/slayers/index.inc: $title .= '::The Slayers';
 /series/slayers/lina/index.inc: $title .= '::Lina Inverse';
 

I would not do it this way, in fact the way I would do this
would not be with your methods at all, unless you want 
to have each section to be arbitrarily different and 
maintained by separate graphics designers.  The way I would
do this thing is to lose the directory structure completely
and to have things be database driven with parameters from
?query_string like /index.asp?dir=, which you can build
the title for from the database because you know all the 
parents for dir=.

The point here is that each ASP script is a whole program
by itself, and I would not recommend having hundreds or
thousands of them to have to compile for your site.  If you
have meta data you want to display, you should really stick
as much of it as possible in a database like MySQL.  In
the long run, your project will be much more maintainable
even if in the short run its easier to derive info from
unix directories  flat files.

If you want to have a nicer /path_info scheme, we'll 
probably have to add a patch for you to have Apache::ASP
not be bound to executing real files as it is currently.
This would be more similar to the way Mason does things.

--Joshua



Re: Apache::ASP #include virtual loses variables

2000-05-20 Thread Philip Mak

On Sat, 20 May 2000, Joshua Chamas wrote:

  !--#include virtual="/code/header.asp"--
  !--#include virtual="/code/footer.asp"--
 
 For #1, know includes will be picked up from your Global directory,
 so you can use that repository to share includes, instead of some
 DOCUMENT_ROOT location.  You can also use IncludesDir for this if
 it is set.

Thanks! That pretty much lets me do exactly what I want to.

  And for #2, I have an "index.inc" in all my directories. Each index.inc
  has to include the one in its parent directory, e.g.:
  
  !--#include file="../index.inc"--
  
  so that directories can pass on properties to their subdirectories. If I
  use include file for that, it will include files relative to the pathname
  of the first ASP file, and not relative to the pathname of the ASP file
  that actually has the include.
  
  ...
  http://www.girlsofanime.com/series/slayers/lina/ has title of
  Girls of Anime::Anime Series::The Slayers::Lina Inverse
  
  The way the title is constructed is:
  
  In /index.inc: $title = 'Girls of Anime';
  /series/index.inc: $title .= '::Anime Series';
  /series/slayers/index.inc: $title .= '::The Slayers';
  /series/slayers/lina/index.inc: $title .= '::Lina Inverse';
  
 
 I would not do it this way, in fact the way I would do this
 would not be with your methods at all, unless you want 
 to have each section to be arbitrarily different and 
 maintained by separate graphics designers.  The way I would
 do this thing is to lose the directory structure completely
 and to have things be database driven with parameters from
 ?query_string like /index.asp?dir=, which you can build
 the title for from the database because you know all the 
 parents for dir=.

There are two reasons why I don't like doing it this way:

(1) The URL is no longer human readable. My site will have a clear
hierarchical structure, so I think it makes sense to mirror that in the
directories. People who want to chop or type URLs (even though I have good
navigation in my web design) can do so, and they can also look at the URL
to get an idea of where they are.

(2) Setting up a database seems to be overkill for this site. The only
meta data that it has (or probably will ever have) is:

- directory name label
- What links are on the sidebar for this directory?
- What advertising banner(s) is displayed on pages in this directory?

My method of having an index.inc for each directory is fairly simple, yet
it would seem to provide all the flexibility I need to implement this and
the flatfiles are easy to maintain. I don't see a good reason to switch to
database-based which seems to be significantly more complicated.

 The point here is that each ASP script is a whole program
 by itself, and I would not recommend having hundreds or
 thousands of them to have to compile for your site.  If you
 have meta data you want to display, you should really stick
 as much of it as possible in a database like MySQL.  In
 the long run, your project will be much more maintainable
 even if in the short run its easier to derive info from
 unix directories  flat files.

Each ASP script is compiled separately? I thought that !--#include
file-- and !--#include virtual-- are supposed to work just like
#include does in C, i.e. it pretends that the text of the included file
was actually pasted directly into the program. Am I thinking about ASP
include in the wrong way?

 If you want to have a nicer /path_info scheme, we'll 
 probably have to add a patch for you to have Apache::ASP
 not be bound to executing real files as it is currently.
 This would be more similar to the way Mason does things.

Well, I would like to suggest that you consider including !--#include
virtual-- in the Apache::ASP distribution, so that included files use the
same namespace. It doesn't make sense logically that include virtual
behaves differently from include file (other than the way the
filename/pathname is interpreted, of course).

-Philip Mak ([EMAIL PROTECTED])





Re: Apache::ASP #include virtual loses variables

2000-05-20 Thread Ime Smits

| Well, I would like to suggest that you consider including !--#include
| virtual-- in the Apache::ASP distribution, so that included files use the
| same namespace. It doesn't make sense logically that include virtual
| behaves differently from include file (other than the way the
| filename/pathname is interpreted, of course).

It does make sense to me, though. Consider one having very big (say 50k)
include files being included from several other (say 100) scripts. Just
sucking them in each script doing the include would cause *every* script
growing by at least the size of the include. Now as Apache::ASP caches all
compiled scripts, this would result in each httpd process growing by 50kB x
100 scripts = 5 MB, holding 98% redundant data.

Giving each include a different namespace (or more accurate: compile it as a
unique sub(), and thus having it's own lexical scope), will cause the
include file being compiled and cached only once.

Ime