Hacker News new | comments | show | ask | jobs | submit login

> - Why send back an array ref instead of using the CGI way? What is the advantage it brings?

If you design a fibonacci() function, would you make it print the result to STDOUT, or return the result as a return value?

If the specification is to print to STDOUT, a web server needs to make a trick to capture the output using tie, PerlIO or anything else, just like FCGI.pm does, and that's inefficient.

> - Are all the $ENV variables available? (SCRIPT_NAME for example?)

http://search.cpan.org/~miyagawa/PSGI-1.03/PSGI.pod#The_Envi...

> I don't really see what advantages it will bring to framework like Mojolicious for example (they will certainly never ever used any Middleware stuff from the Plack namespace as this is at the heart of their policy

See this post by the Mojolicious author, how to use Plack middleware for ANY Mojolicious based apps http://blog.kraih.com/mojolicious-and-plack

Also for Dancer: http://advent.perldancer.org/2010/22




> If the specification is to print to STDOUT, a web server needs to make a trick to capture the output using tie, PerlIO or anything else, just like FCGI.pm does, and that's inefficient.

I see. That's a valid point. So when I asked if by design the protocol would offer better performance, the answer is yes?

Is this inefficiency so bad that changing it to an array ref brings THAT much improvement though?

It was easy to change the output but I will have to create a thin wrapper around FastCGI/PSGI to make it transparent. something like this detection done in Mojo becomes necessary:

# PSGI (Plack only for now) return 'psgi' if defined $ENV{PLACK_ENV};

  # CGI
  return 'cgi' if defined $ENV{PATH_INFO} || defined $ENV{GATEWAY_INTERFACE};
well, that's not much work...

I'll continue porting the app and see how it behaves.

Thank you for your time.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: