This is PerlMonks "Mobile"

Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  


in reply to Adding to legacy application: does it make sense to use PSGI in CGI mode

Hi,

When you say "application" what is that? And how is that different from "script"?

What does the code look like? How many files comprise that thing?

Have you ever read CGI to mod_perl Porting. mod_perl Coding guidelines?

No, Dancer doesn't demands a VirtualHost, where'd you get that idea?

Drop in a /cgi-bin/gavotte.cgi and dance at the speed of cgi

  • Comment on Re: Adding to legacy application: does it make sense to use PSGI in CGI mode
  • Download Code

Replies are listed 'Best First'.
Re^2: Adding to legacy application: does it make sense to use PSGI in CGI mode
by hotpelmen (Scribe) on Mar 02, 2021 at 05:42 UTC

    Hi, thanks for taking time to respond. Please pardon my lack of experience with Dancer and PSGI, I just started looking into them, and I am sure I misunderstand some of their advantages or requirements to implement.

    Here some more details in response to your questions.

    When you say "application" what is that? And how is that different from "script"?

    By "Perl/CGI web application" I mean a collection of Perl/CGI scripts that are united by sitting in the same cgi-bin directory, sharing some code, and serving common business goal. Different from a single script only in number of scripts.

    What does the code look like? How many files comprise that thing?

    In each script Perl code uses CGI.pm to get request parameters and prints HTML. mod_perl is not being used anywhere in this. There are probably 50 or so of these scripts implementing 50 or so of pages. I am looking for an efficient way to add 1 more page to that collection. Maybe a page or two in a few months.

    Have you ever read CGI to mod_perl Porting. mod_perl Coding guidelines?

    No, I have not read it, why, are you recommending to use mod_perl for new pages?

    No, Dancer doesn't demands a VirtualHost, where'd you get that idea? Drop in a /cgi-bin/gavotte.cgi and dance at the speed of cgi

    I got that idea about VirtualHost from "Running under Apache" section of Dancer2::Manual::Deployment doc. I had an impression that to take advantage of Dancer's features I'd need entire skeleton directory and for that I need VirtualHost so that I could direct traffic to dispatch.cgi. I have not read enough to really understand the whole effort but I got a feeling that trying to fit Dancer2 into an old application will be too much work. However if a new page will be better off when implemented in Dancer2 (as opposed to CGI.pm+Template or PSGI/Plack) then any thoughts supporting it would be appreciated.

    So given all that, does my question about use of Template and PSGI/Plack to add occasional pages to old application make more sense?
      Ok. How many of those scripts did you write? The best advice i have for you is read the tutorial i linked and grab a copy of Modern Perl 2011-2012 Edition. Pretend PSGI doesn't exist for now. Copy one .cgi and turn it into a new page.
        Thanks for your advice. Just started reading 2014 edition of Modern Perl for kindle a few days ago.