This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package MyBaseWorker; | |
extends 'TheSchwartz::Moosified::Worker' | |
sub work { | |
my $class = shift; | |
my $job = shift; | |
my $subtasks = $job->{subtasks}; | |
for my $subtask (@$subtasks) { | |
my $task = Subtask::Factory->Create($subtask); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Moose::Meta::Class->create_class('MyParticularWorker' => ['BasicWorker','Fetcher','LOLifier']); | |
$client->can_do('MyParticularWorker'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use Benchmark qw/cmpthese/; | |
# perl 5.8.6 x86_64-linux-gnu-thread-multi | |
# Rate h_e l_c h_d l3_e l2_e l_e l_d l2_d l_a l2_a l2_b l_b a_c hr_e hr_f | |
# h_e 371747/s -- -1% -21% -22% -23% -24% -34% -40% -42% -43% -53% -53% -57% -74% -78% | |
# l_c 377358/s 2% -- -20% -21% -22% -23% -33% -39% -42% -42% -52% -52% -57% -73% -77% | |
# h_d 469484/s 26% 24% -- -2% -3% -4% -17% -24% -27% -28% -40% -40% -46% -67% -72% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The hard way | |
* manual constructors and accessors | |
The declarative way | |
* Perhaps compare some of the older accessor-generators. | |
The Moose way | |
* declarative = good. | |
Attributes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Plack::Server::CoroAnyEvent; | |
use warnings; | |
use strict; | |
use base 'Plack::Server::AnyEvent'; | |
use Coro; | |
use Coro::AnyEvent; | |
use AnyEvent (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
use Test::More; | |
use JavaScript; | |
my $rt = JavaScript::Runtime->new; | |
my $cx = $rt->create_context; | |
my $js_callback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use Devel::Size qw/size total_size/; | |
use constant N => 1_000_000; | |
fillerup: { | |
my $x = [2 .. N]; | |
print size($x) . " " . total_size($x) . "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
Iconv = require('iconv').Iconv, | |
buffertools = require('buffertools'); | |
function goGetAmazon() { | |
var headers; | |
var chunks = []; | |
var req = http.request({ | |
method: 'GET', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vows = require 'vows' | |
assert = require 'assert' | |
vows.describe("nesting").addBatch( | |
"top": | |
topic: () -> "topval" | |
"check": () -> console.log(arguments); assert.ok 1 | |
"alpha": | |
topic: () -> | |
console.log("topic alpha",arguments) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'), | |
http = require('http'); | |
var ws = fs.createWriteStream('/tmp/get.png',{flags:'w'}); | |
var reqOpts = { | |
method: 'GET', | |
path: '/images/nav_logo83.png', | |
host: 'www.google.ca' | |
}; |
OlderNewer