Re: Calling an Apache::ASP page from an Apache::Registry script
Andrew Ho wrote: I've been investigating other template systems to try to find similar functionality in an existing package for a non-Tellme related project and haven't been able to find any embedded-Perl solutions that can be called from a .pl and still have the benefits of template caching. Apache::ASP doesn't seem like the best fit for this, if you really don't want to use pages as controllers. You can use Text::Template (just keep a cache of the templates in a global hash) or Template Toolkit for this (yes, it does allow in-line Perl). It also may be possible to do this with Mason. - Perrin
Calling an Apache::ASP page from an Apache::Registry script
Hello, Apologies if this has been asked before; I searched the archives but couldn't find a reference to this. It's been discussed in the context of MVC design a while back, but I don't have a solid answer to the following question: can you call an Apache::ASP page from an Apache::Registry script? Couched in MVC terminology, can I forward control from a .pl controller to a .asp template, and pass arguments in a natural way? I can imagine doing an internal redirect, and passing arguments via pnotes()... but something like this would be way cooler: Inside caller.pl: use Apache::ASP (); Apache::ASP-forward('template.asp', @args); Inside template.asp: % my @args = @_ % My arguments were: %= join ', ', @args %. Using an internal redirect you'd have to find the previous request and its pnotes, and do various other mucky stuff. Of course the interface above is kind of arbitrary. You could choose some ASP style object to cram the passed parameters into, or have a built in program call to retrieve parameters passed from the caller. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Calling an Apache::ASP page from an Apache::Registry script
Andrew Ho wrote: Hello, Apologies if this has been asked before; I searched the archives but couldn't find a reference to this. It's been discussed in the context of MVC design a while back, but I don't have a solid answer to the following question: can you call an Apache::ASP page from an Apache::Registry script? Couched in MVC terminology, can I forward control from a .pl controller to a .asp template, and pass arguments in a natural way? ... The safest thing to do right now would probably be to do an external redirect to the ASP page like: Apache-request-header_out('Location', script.asp?$ARGS); I do not think you would be able to pull off an internal redirect, or you might, but there might be complications if the first script tried to read POST input on STDIN, and then the ASP script tried also, there would probably be a hang. You could also call the registry/cgi as an asp script directly and have access to the ASP API like: # cgi wrapper script.asp, works with inline includes ( DynamicIncludes 0 ) % !--#include file=script.pl-- % or % do script.pl; % then the script.pl could do all the ASP API calls it likes as in: # script.pl ... $Server-Transfer('redirect_to.asp', @args); ... If what you really want is to simply load an external ASP script as a template for further processing in the script.pl, and you only want to run script.pl as an Apache::Registry script, there is not an API for doing this currently. --Josh _ Joshua Chamas Chamas Enterprises Inc. NodeWorks Founder Huntington Beach, CA USA http://www.nodeworks.com1-714-625-4051
Re: Calling an Apache::ASP page from an Apache::Registry script
Hello, AH...can you call an Apache::ASP page from an Apache::Registry script? AHCouched in MVC terminology, can I forward control from a .pl controller AHto a .asp template, and pass arguments in a natural way? JCThe safest thing to do right now would probably be to do an external JCredirect to the ASP page like: JC Apache-request-header_out('Location', script.asp?$ARGS); Thanks for the quick response. I didn't think of the POST data reading conflict. A related question, is there any way to make Apache::ASP not initialize its $Request object by default? This is the only blocker from using the Apache::Request API in an Apache::ASP page. JCIf what you really want is to simply load an external ASP script as a JCtemplate for further processing in the script.pl, and you only want to JCrun script.pl as an Apache::Registry script, there is not an API for JCdoing this currently. Specifically what I'm trying to do is to emulate $Server-Transfer but from an Apache::Registry script. I don't need to further process the Apache::ASP template in the Apache::Registry script. I think an .asp that has % at the top of the file and % at the end of it would be similar; but I'd prefer using Apache::Registry to (1) eliminate the % % tokens and more importantly (2) continue using the Apache::Request interface which I'm used to. We actually wrote our own template language at Tellme a long time ago to support specifically this paradigm, which is really convenient for simple templates (we considered releasing it--running templates is usually as fast as or faster than running Apache::Registry scripts--but just then, there was a don't write another stupid template system flame war, so we decided not to!). It's also super convenient for MVC style programming (modules are the M, Apache::Registry scripts the C, templates the V). I've been investigating other template systems to try to find similar functionality in an existing package for a non-Tellme related project and haven't been able to find any embedded-Perl solutions that can be called from a .pl and still have the benefits of template caching. I prefer embedded Perl because it's so convenient for little niceties (for example, Your search found %= $n || 'no' % document%= $n == 1 ? '' : 's' %.) that real-world HTML interfaces need. So that's what I'm looking for. :) Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --