git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/2] gitweb: Add support for running gitweb as FastCGI script

From
Peter Vereshagin <peter@vereshagin.org>
Date
May 16, 2010, 10:15 UTC
Message-ID
<20100516101528.GA5761@screwed.box>
In-Reply-To
<201005151558.12191.jnareb@gmail.com>

Be sure to wear flowers on your hat, Jakub! 2010/05/15 15:58:11 +0200 Jakub Narebski <jnareb@gmail.com> => To Peter Vereshagin : === JN> > eval "use Image::Magick;"; JN> > if ($@){ JN> > === JN> > JN> > are those lemmings wrong? JN> JN> No they are not.

so that code is just right, and this: === eval( 'use Module;' ); die $@ if $@; ===

is 'Wrong!'. And what is the difference?

JN> would work as expected, I think that 'use' in conditional 'eval BLOCK' would JN> not.

I think so too as I did never meant about eval BLOCK;

JN> if (<condition>) { JN> eval { use Image::Magick; } JN> ... JN> } JN> JN> So if you want to use 'eval BLOCK' form, you need to use 'require' and not JN> 'use': JN> JN> if (<condition>) { JN> eval { require Image::Magick; import Image::Magick; } JN> ... JN> } JN> JN> JN> Second, if you are not interested in error condition, and only whether JN> require'ing some module failed or not, then instead of JN> JN> eval { require Net::SSLeay }; JN> no_SSL_warning($URL) if $@; JN> JN> you can use the 'eval { <sth>; 1 };' idiom, i.e. JN> JN> eval { require Net::SSLeay; 1; } JN> or no_SSL_warning($URL);

'eval BLOCK' versus 'eval EXPR' it's just better, but not a tabu. 'eval EXPR' with $@ checking causes no any errors on the same runtime with the code to be executed later. For most cases the modules are used, the read/parsing error can be the only error possible as no run-time code happens out there but only the symbols declaration. Therefore checking $@ is just fine.

JN> When I added checking for $@ in the form of 'die $@ if $@', the error that JN> Perl shown was the syntax error in the foo() subroutine in $file file.

and this is where the $@ was sufficient, too.

JN> I don't know if it would be complete replacement for FCGI::Spawn, but from JN> your description of it, using Plack::App::CGIBin middleware (+ plackup + JN> Plack::Handler::FCGI wrapper) could be a valid alternative to it..

There are some more features those are on by default in FCGI::Spawn if they are to be replaced, not sure if I will find them inside that framework.

JN> P.S. About Girocco: instead of writing it as set of separate CGI scripts, it JN> could have been instead written as single app, loading its modules ('use JN> lib' would help).

... and sharing them with gitweb, right. ;-)
73! Peter pgp: A0E26627 (4A42 6841 2871 5EA7 52AB  12F8 0CE1 4AAC A0E2 6627)
-- 
http://vereshagin.org
Previous: Jakub NarebskiNext: Jakub Narebski
Message 27 of 30 in “gitweb: Add support for running gitweb as FastCGI script”
  1. 0/2 gitweb: Add support for running gitweb as FastCGI scriptJakub Narebski, May 7, 2010
  2. 1/2 gitweb: Put all per-connection code in run() subroutineJakub Narebski, May 7, 2010
  3. 2/2 gitweb: Add support for FastCGI, using CGI::FastJakub Narebski, May 7, 2010
  4. 2/2 gitweb: Add support for FastCGI, using CGI::FastJakub Narebski, May 8, 2010
  5. Jakub NarebskiMay 8, 2010
  6. Eric WongMay 9, 2010
  7. Ævar Arnfjörð BjarmasonMay 9, 2010
  8. Jakub NarebskiMay 9, 2010
  9. Peter VereshaginMay 9, 2010
  10. Jakub NarebskiMay 9, 2010
  11. Peter VereshaginMay 10, 2010
  12. Jakub NarebskiMay 10, 2010
  13. Peter VereshaginMay 11, 2010
  14. Petr BaudisMay 11, 2010
  15. Jakub NarebskiMay 11, 2010
  16. Peter VereshaginMay 11, 2010
  17. Jakub NarebskiMay 11, 2010
  18. Peter VereshaginMay 13, 2010
  19. Ævar Arnfjörð BjarmasonMay 13, 2010
  20. Peter VereshaginMay 14, 2010
  21. Jakub NarebskiMay 14, 2010
  22. Peter VereshaginMay 14, 2010
  23. Jakub NarebskiMay 14, 2010
  24. Jakub NarebskiMay 14, 2010
  25. Peter VereshaginMay 15, 2010
  26. Jakub NarebskiMay 15, 2010
  27. Peter VereshaginMay 16, 2010
  28. Jakub NarebskiMay 18, 2010
  29. Petr BaudisMay 16, 2010
  30. Petr BaudisMay 15, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.