You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jeff Ng <jn...@ondevice.com> on 2000/10/26 19:07:10 UTC

sending Apache::ASP output to a variable?

I would like to Apache::ASP to parse pages in an existing mod_perl
environment.  Ideally, I could set headers with mod_perl, then use
Apache::ASP to parse templates which I can arbitrarily combine.  It seems
that using Apache::ASP forces me to do most of my coding in the perlscript
whereas I would prefer to minimize this for the sake of not interspersing
too much code within the HTML.

As it stands, it appears that the output of Apache::ASP goes directly to
stdout.  Is there a way to use Apache::ASP as part of a normal mod_perl
module, then capture the output to a variable?

Or perhaps there is a better solution using Mason?


         Jeff Ng
Lead Web Developer
   onDevice Corp.
 jng@ondevice.com


Re: sending Apache::ASP output to a variable?

Posted by Joshua Chamas <jo...@chamas.com>.
Jeff Ng wrote:
> 
> I would like to Apache::ASP to parse pages in an existing mod_perl
> environment.  Ideally, I could set headers with mod_perl, then use
> Apache::ASP to parse templates which I can arbitrarily combine.  It seems
> that using Apache::ASP forces me to do most of my coding in the perlscript
> whereas I would prefer to minimize this for the sake of not interspersing
> too much code within the HTML.
> 
> As it stands, it appears that the output of Apache::ASP goes directly to
> stdout.  Is there a way to use Apache::ASP as part of a normal mod_perl
> module, then capture the output to a variable?
> 

Apache::ASP was built to be a fully standalone environment, thus
doing this is not easy.  It would be a worthwhile extension of
the environment to be able to use Apache::ASP just to render
specific templates, and provide the output back to the caller,
but an extension it would be, quite significant I would imagine.

> Or perhaps there is a better solution using Mason?
> 

... also some of the other templating solutions, which were
designed for this purpose.

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

Re: sending Apache::ASP output to a variable?

Posted by Les Mikesell <le...@home.com>.
----- Original Message -----
From: "Jeff Ng" <jn...@ondevice.com>
To: <mo...@apache.org>
Sent: Thursday, October 26, 2000 12:07 PM
Subject: sending Apache::ASP output to a variable?


> I would like to Apache::ASP to parse pages in an existing mod_perl
> environment.  Ideally, I could set headers with mod_perl, then use
> Apache::ASP to parse templates which I can arbitrarily combine.  It seems
> that using Apache::ASP forces me to do most of my coding in the perlscript
> whereas I would prefer to minimize this for the sake of not interspersing
> too much code within the HTML.
>
> As it stands, it appears that the output of Apache::ASP goes directly to
> stdout.  Is there a way to use Apache::ASP as part of a normal mod_perl
> module, then capture the output to a variable?

One thing that may not be obvious is that if you use mod_include in
apache along with mod_perl and put something like:
<!--#include virtual="/cgi-bin/perlprog.pl$PATH_INFO?$QUERY_STRING" -->
in the *.shtml file, apache will run it efficiently as a subrequest in
the same process (assuming apache is configured to run that URL under
mod_perl) and substitute the output in the page.  It isn't quite as flexible
as being able to reparse the output by a program but it does let people
who are likely to break the perl programs use them in their html pages.

   Les Mikesell
    lesmikesell@home.com



Re: sending Apache::ASP output to a variable?

Posted by "G.W. Haywood" <ge...@www.jubileegroup.co.uk>.
Hi there,

On Thu, 26 Oct 2000, Jeff Ng wrote:

> it appears that the output of Apache::ASP goes directly to
> stdout.  Is there a way to use Apache::ASP as part of a normal mod_perl
> module, then capture the output to a variable?

Have a look at sub PRINT and sub PRINTF in ASP.pm, I'm sure you can do
what you want there.  Check out the Eagle Book if you're unsure about
tied filehandles.

73,
Ged.