Skip to content

Instantly share code, notes, and snippets.

View plu's full-sized avatar
🏠
Working from home

Johannes Plunien plu

🏠
Working from home
  • Kleinanzeigen
  • Germany
View GitHub Profile
diff --git a/lib/FCGI/Engine/Core.pm b/lib/FCGI/Engine/Core.pm
index 19bb392..c58b76d 100644
--- a/lib/FCGI/Engine/Core.pm
+++ b/lib/FCGI/Engine/Core.pm
@@ -173,6 +173,10 @@ sub run {
$proc_manager->manage;
}
+ elsif ( $self->nproc > 1 ) {
+ $proc_manager = $self->create_proc_manager( %addtional_options );
#!/usr/bin/env perl
use strict;
use warnings;
use Gearman::XS::Worker;
use Gearman::XS qw(:constants);
use Imager;
my $worker = Gearman::XS::Worker->new;
$worker->add_server( 'localhost', 4730 );
#!/usr/bin/env perl
use strict;
use warnings;
use Gearman::XS::Worker;
use Gearman::XS qw(:constants);
use Imager;
my $worker = Gearman::XS::Worker->new;
$worker->add_server( 'localhost', 4730 );
#!/usr/bin/env perl
use strict;
use warnings;
use Gearman::XS::Worker;
use Gearman::XS qw(:constants);
use Imager;
my $worker = Gearman::XS::Worker->new;
$worker->add_server( 'localhost', 4730 );
package GDExamples::Convert;
use base qw(Gearman::Driver::Worker);
use Moose;
use Imager;
sub process_name {
my ( $self, $orig, $job_name ) = @_;
return "$orig ($job_name)";
}
usage: gearman_driver.pl [long options...]
--loglevel Log level (default: INFO)
--lib Example: --lib ./lib --lib /custom/lib
--max_idle_time How many seconds a worker may be idle before its killed
--server Gearman host[:port][,host[:port]]
--logfile Path to logfile (default: gearman_driver.log)
--console_port Port of management console (default: 47300)
--interval Interval in seconds (see Gearman::Driver::Observer)
--loglayout Log message layout (default: [%d] %p %m%n)
--namespaces Example: --namespaces My::Workers --namespaces My::OtherWorkers
sub prefix {
return ref(shift) . '::';
}
gearman_driver_console.pl --server localhost:47300
console> status
localhost:47300> GDExamples::Convert::convert_to_gif 0 5 0 2010-01-30T19:45:43 1970-01-01T00:00:00
localhost:47300> GDExamples::Convert::convert_to_jpeg 0 5 0 2010-01-30T19:45:53 1970-01-01T00:00:00
localhost:47300> .
console> set_processes GDExamples::Convert::convert_to_gif 2 10
localhost:47300> OK
localhost:47300> .
console> status
localhost:47300> GDExamples::Convert::convert_to_gif 2 10 2 2010-01-30T19:45:43 1970-01-01T00:00:00
use strict;
use warnings;
use Irssi;
use Glib;
use POE qw(Loop::Glib Session::Irssi);
use Net::Twitter;
use HTML::Entities qw( decode_entities );
use HTTP::Date qw( time2str );
my $VERSION = '0.1';
#!/usr/bin/env perl
use strict;
use warnings;
my $package = get_package( path => $ENV{TM_FILEPATH}, walk_up_to => 'lib' );
my $content = get_content();
if ($content) {
$content =~ s/^package (.*?);/package $package;/;
print $content;