View rtmp connect dumper
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 strict; | |
use warnings; | |
use FindBin::libs; | |
use YAML; | |
use Sniffer::RTMP; | |
my $dev = $ARGV[0] or die 'require device name'; |
View gist:49972
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
my $router = HTTP::Router->define(sub { | |
$_->with({ controller => 'users' }, sub { | |
$_->match('/login')->register; | |
$_->match('/logout')->register; | |
$_->match('/signup')->register; | |
}); | |
}); |
View gist:51460
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 MyApp; | |
__PACKAGE__->request_class('MyApp::Request'); | |
package MyApp::Request; | |
use strict; | |
use parent 'Catalyst::Request'; | |
sub method { |
View gist:62002
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 Data::OpenStruct::Deep; | |
my %hash = ( | |
foo => 1, | |
bar => { | |
baz => 2, | |
}, | |
); |
View gist:74893
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
diff --git a/lib/Mouse/Meta/Role.pm b/lib/Mouse/Meta/Role.pm | |
index 95bdca8..fd2fc11 100644 | |
--- a/lib/Mouse/Meta/Role.pm | |
+++ b/lib/Mouse/Meta/Role.pm | |
@@ -107,7 +107,20 @@ sub apply { | |
for my $name ($self->get_attribute_list) { | |
next if $class->has_attribute($name); | |
my $spec = $self->get_attribute($name); | |
- Mouse::Meta::Attribute->create($class, $name, %$spec); | |
+ |
View gist:78645
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
diff --git a/lib/ShipIt/VC/Git.pm b/lib/ShipIt/VC/Git.pm | |
index 9bf21d7..b5b6c2c 100644 | |
--- a/lib/ShipIt/VC/Git.pm | |
+++ b/lib/ShipIt/VC/Git.pm | |
@@ -61,6 +61,18 @@ sub commit { | |
print $tmp_fh $msg; | |
my $tmp_fn = "$tmp_fh"; | |
system($command, "commit", "-a", "-F", $tmp_fn); | |
+ | |
+ if (my $where = $self->{push_to}) { |
View gist:86675
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 MouseX::Log::Log4perl; | |
use Mouse::Role; | |
use Log::Log4perl; | |
our $VERSION = '0.01'; | |
has 'logger' => ( | |
is => 'rw', | |
isa => 'Log::Log4perl', |
View gist:90608
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
# release-0.01 (CPAN) | |
Benchmark: timing 10000 iterations of match, match_block, to_block, with... | |
match: 14.2198 wallclock secs (13.88 usr + 0.05 sys = 13.93 CPU) @ 717.88/s (n=10000) | |
match_block: 14.6266 wallclock secs (14.44 usr + 0.04 sys = 14.48 CPU) @ 690.61/s (n=10000) | |
to_block: 15.8561 wallclock secs (15.69 usr + 0.05 sys = 15.74 CPU) @ 635.32/s (n=10000) | |
with: 15.2271 wallclock secs (14.78 usr + 0.07 sys = 14.85 CPU) @ 673.40/s (n=10000) | |
# 32664d58be4ebfea9c445aa91bac1709e62ce5fa (Class::Accessor::Fast) | |
Benchmark: timing 10000 iterations of match, match_block, to_block, with... | |
match: 8.87748 wallclock secs ( 8.79 usr + 0.02 sys = 8.81 CPU) @ 1135.07/s (n=10000) |
View gist:90616
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
# Merb-like | |
use HTTP::Router::Declare; | |
my $router = router { | |
# path and params | |
match '/' => to { controller => 'Root', action => 'index' }; | |
# path, conditions, and params | |
match '/home', { method => 'GET' } => to { controller => 'Home', action => 'show' }; |
View benchmark_openhash.pl
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 strict; | |
use warnings; | |
use Hash::Inflator; | |
use Hash::AsObject; | |
use Data::OpenStruct::Deep; | |
use Test::MockObject; | |
use Benchmark qw(:hireswallclock cmpthese); |
OlderNewer