This file contains hidden or 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
# This would work better with subroutine signatures | |
cases 'test all combinations', { | |
cases => { | |
set_a => sub { return( 5, 5 ) }, | |
set_b => sub { return( 4, 6 ) }, | |
set_c => sub { return( 3, 7 ) }, | |
set_d => sub { return( 2, 8 ) }, | |
}, | |
tests => { | |
'equals 10' => sub { |
This file contains hidden or 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 strict; | |
use warnings; | |
use File::Copy; | |
use Benchmark qw(cmpthese); | |
my $file = shift; | |
my $moved = "$file.mv"; |
This file contains hidden or 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 strict; | |
use warnings; | |
use File::Copy; | |
use Benchmark qw(cmpthese); | |
my $tries = shift || -3; | |
my $re = shift; |
This file contains hidden or 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 strict; | |
use warnings; | |
use Benchmark qw(cmpthese); | |
use Tie::File; | |
use Fcntl 'O_RDONLY'; | |
sub read_range { |
This file contains hidden or 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 | |
{ | |
package MyRole; | |
use Moose::Role; | |
requires "this"; | |
sub that { 42 } | |
} |
This file contains hidden or 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
class: | |
name: Foo::Bar | |
attributes: | |
foo: { is: ro, isa: Str } | |
bar: { is: rw, isa: Int } | |
methods: | |
something: !method | | |
print "Something something something\n"; | |
This file contains hidden or 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
for my $name (qw/ok skip todo_skip current_test/) { | |
my $orig = *{"Test::Builder::${name}"}{CODE}; | |
*{"Test::Builder::${name}"} = sub { | |
my $self = shift; | |
$self->current_test($Curr_Test); | |
local $Test::Builder::Level += 4; | |
$STORE->lock_cb(sub { | |
$self->$orig->(@_); | |
$Curr_Test = $self->current_test; |
This file contains hidden or 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
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int lengthi_log(int x) { | |
int length = 0; | |
if( x == 0 ) | |
return 1; |
This file contains hidden or 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 -w | |
use MooseX::Declare; | |
class WithDeclare { | |
has greetings => | |
is => 'rw', | |
isa => 'Str', | |
default => "Hello" | |
; |
This file contains hidden or 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 SD::MW::Auth::Anonymous; | |
use Mouse; | |
use MouseX::Foreign "Plack::Middleware"; | |
use Plack::Request; | |
use Plack::Response; | |
use CGI::Simple::Cookie; | |