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; | |
sub maps { | |
open my $fh, '<', '/proc/self/maps'; | |
my @lines = <$fh>; | |
my %ret = map { | |
m{\ {10}(/.+)$} ? ($1,$_) : () | |
} @lines; |
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
#!perl6 | |
use v6.c; | |
class Thing { | |
method blah($val=1) { 15+$val } | |
} | |
class Thunk { | |
has $.maker; |
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 Test::More; | |
# this works in 5.8 and 5.24, fails under 5.18 5.20 and 5.22 | |
sub do_it { | |
my ($call) = @_; | |
eval { |
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 5.020; | |
package String::Formatter::Tagged { | |
use parent 'String::Formatter'; | |
use String::Tagged; | |
use Safe::Isa; |
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 PerlIO::via::Trace; | |
use strict; | |
use warnings; | |
use Fcntl; | |
use Devel::StackTrace; | |
my $log_fh; | |
sub _trace { | |
my $fh = shift; | |
local $@;local $!; |
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 Benchmark; | |
use List::Util; | |
my @keys = List::Util::shuffle( (1..500) x 1000, 600..800 ); | |
Benchmark::cmpthese(-5, { | |
with_test => 'my %h; for my $k (@keys) { $h{$k}=1 unless exists $h{$k} }', |
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 5.018; | |
use open ':std',':locale'; | |
use LWP::Simple; | |
use URI::_punycode; | |
my $root_zone = get('https://www.internic.net/domain/root.zone'); | |
my @root_records = split /\n/,$root_zone; |
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 5.020; | |
use autodie; | |
use Try::Tiny; | |
use File::Find::Rule; | |
use File::stat; | |
use Digest::MD5; |
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
#!perl | |
use strict; | |
use warnings; | |
package ForceSessionSave { | |
use parent 'Plack::Middleware'; | |
sub call { | |
my ($self,$env) = @_; | |
my $res = $self->app->($env); |
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 5.018; | |
package App { | |
use Moose; | |
has model1 => ( is => 'ro', isa => 'Model1', ); | |
has model2 => ( is => 'ro', isa => 'Model2', ); |