On Fri, Apr 22, 2011 at 11:15 PM, David Christensen <dpchr...@holgerdanske.com> wrote: > On 04/22/2011 10:11 AM, sono...@fannullone.us wrote: > >> I realize that this list may not be the best, or even most >> appropriate, place to ask this question, but I'm just so curious that I'm >> losing sleep over it! =;) >> What is the best way to embed perl in an HTML file that is _not_ >> located under the cgi-bin directory? I started learning PHP for this very >> reason, but I keep coming back to Perl. I've read some about Template >> Toolkit and others, but what I'm still confused over is if these templates >> _must_ be located in cgi-bin or can you embed code anywhere on your site? >> If possible, I would like to be able to embed perl, placeholders, >> templates, whatever, anywhere on my site. Perhaps I'm working under the >> wrong impression, but for some reason I'm thinking you can't. Hopefully I'm >> wrong. Any help in pointing me in the right direction will be greatly >> appreciated. > > I've had similar experiences with PHP. > > > Perl is extremely flexible. Depending upon your particulars, you can put > Perl scripts under cgi-bin/, you can put Perl scripts under public_html/, > you can invoke Perl scripts from within web page source files, you can put > Perl code inside web page source files, you can put a Perl interpreter and > handlers inside your web server, you can write a Perl web server, and other > permutations that I've forgotten or haven't tried yet. The upside of > TIMTOWTDI [1] is that there are lots of choices. The downside is that > finding the right set of choices for a particular person and project is a > non-trivial undertaking. >
per "you can put a Perl interpreter and handlers inside your web server" you might look for a modperl script to handle what you want. something that puts your perl in every web page. this had good ideas: http://modperlbook.org/html/4-2-7-Stacked-Handlers.html you might also check out this book - this chapter in particular might be helpful: http://docstore.mik.ua/orelly/weblinux2/modperl/appb_15.htm this was so well written, i couldn't help sharing: https://perl.apache.org/docs/2.0/user/handlers/filters.html you can also do this (pretty easy) with psgi, check this out for ideas (it's a bit outdated for psgi but i think i'm bookmarking this one anyway :) ): http://perliscope.blogspot.com/2009/11/psgi-and-plack-future-of-web.html notice how i prefer the sledgehammer approach? i like handling as much as possible before the app ever sees *anything*. this is just preference. reread what David said. it's worth noting. note: i think we're out of the realm of 'beginner' here so i'm just passing ideas. if you want to try and tackle one, i think it might be very worth while. however, if you find yourself stuck either ask or don't worry about it. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/