[FASTCGI] [perl+lighttpd] Custom Include library issue

Matthew Weigel unique at idempot.net
Wed Oct 6 13:52:37 EDT 2010


 This looks like Embed::Persistent is behaving oddly.  I've never used 
 it before, but it's not a bug in lighttpd, CGI::Fast, or anything very 
 relevant to this list.  You might look into other ways to achieve what 
 you're trying to do, which appears to be "get a FastCGI handler for any 
 Perl script similar to php-fastcgi for PHP."
-- 
  Matthew Weigel
  hacker
  unique & idempot . ent

 On Wed, 6 Oct 2010 18:54:11 +0200, Salvatore De Paolis <iwkse at gmx.com> 
 wrote:
> Hi all,
>
> I'm new to this list, that's my first post.
> I'm here to ask for help hoping it's the right place to get some 
> hints.
>
> I'm using fastcgi perl module with lighttpd, everything works fine 
> when
> not including custom files.
>
> I show an example:
>
> #!/usr/bin/perl -w
>
> use warnings;
> use strict;
> use lib '/custom/folder/lib';
> use MyCustomLib;
>
> html_start('title','img/favicon.ico','css/style.css', $jsblob);
>
>
> The first time I execute this code, the html_start() is undefined,
> as the library was not included.
> On the second attempt, reloading the page, it works just fine and do
> what it should.
>
> My lighttpd configuration for perl is:
>
> fastcgi.server += ( ".pl" =>
>         ((
>           "socket" => "/tmp/perl-fastcgi.socket",
>           "bin-path" => var.docroot + "/perl_dispatcher.fcgi",
> 	  "check-local" => "disable",
>           "min-procs" => 2,
>           "max-procs" => 5,
>           "idle-timeout"    => 20
>          ))
> )
>
> content of perl_dispatcher.fcgi
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use CGI::Fast;
> use Embed::Persistent;
> {
>     my $p = Embed::Persistent->new();
>     while (new CGI::Fast) {
>         my $filename = $ENV{SCRIPT_FILENAME};
>         my $package = $p->valid_package_name($filename);
>         my $mtime;
>         if ($p->cached($filename, $package, \$mtime))
>         {
>             eval {$package->handler;};
>         }
>         else
>  	{
>             $p->eval_file($ENV{SCRIPT_FILENAME});
>         }
>     }
> }
>
> error log while executing the script:
>
> 2010-10-06 18:44:36: (mod_fastcgi.c.2979) got proc: pid: 6090 socket:
> unix:/tmp/perl-fastcgi.socket-3 load: 1
> 2010-10-06 18:44:36: (mod_fastcgi.c.2610) FastCGI-stderr: Undefined
> subroutine &Embed::home::www::iwkse::docs_2epl::html_start called at
> (eval 34) line 14.
>  at /home/www/perl_dispatcher.fcgi line 18
> Undefined subroutine &Embed::home::www::iwkse::docs_2epl::html_start
> called at (eval 34) line 14.
>  at /home/www/perl_dispatcher.fcgi line 18
>
> 2010-10-06 18:44:36: (mod_fastcgi.c.1508) released proc: pid: 6090
> socket: unix:/tmp/perl-fastcgi.socket-3 load: 0
> 2010-10-06 18:44:38: (mod_fastcgi.c.1761) connect failed: Connection
> refused on unix:/tmp/perl-fastcgi.socket-3
> 2010-10-06 18:44:38: (mod_fastcgi.c.2930) backend died; we'll disable
> it for 5 seconds and send the request to another backend instead:
> reconnects: 0 load: 2
> 2010-10-06 18:44:38: (mod_fastcgi.c.2726) --- fastcgi spawning
>         socket unix:/tmp/perl-fastcgi.socket-3
>         current: 1 / 5
> 2010-10-06 18:44:38: (mod_fastcgi.c.794) new proc, socket: 0
> /tmp/perl-fastcgi.socket-3
> 2010-10-06 18:44:38: (mod_fastcgi.c.2979) got proc: pid: 6092 socket:
> unix:/tmp/perl-fastcgi.socket-3 load: 1
> cat: errore di scrittura: Pipe rotta
> 2010-10-06 18:44:38: (mod_fastcgi.c.1508) released proc: pid: 6092
> socket: unix:/tmp/perl-fastcgi.socket-3 load: 0
> 2010-10-06 18:44:41: (mod_fastcgi.c.2979) got proc: pid: 6092 socket:
> unix:/tmp/perl-fastcgi.socket-3 load: 1
>
> Anyone has a clue about what it could be?
> Right now the code works if just on one script but it's an ugly and
> redundant solution :\
> Any help is really appreciated,
>
> regards,
> Salvatore
> _______________________________________________
> FastCGI-developers mailing list
> FastCGI-developers at mailman.fastcgi.com
> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers




More information about the FastCGI-developers mailing list