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/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 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/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 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
| #!perl6 | |
| use v6.c; | |
| class Thing { | |
| method blah($val=1) { 15+$val } | |
| } | |
| class Thunk { | |
| has $.maker; |
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/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 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 HelperThing; | |
| use strict; | |
| use warnings; | |
| use Moose::Exporter; | |
| use 5.024; | |
| use experimental 'signatures'; | |
| use MethodMetaRole; | |
| sub my_method($meta,$name,@args) { | |
| my $body = pop @args; |
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
| use v6.d.PREVIEW; | |
| use Cro::HTTP::Router; | |
| use Cro::HTTP::Middleware; | |
| use Cro::HTTP::Response; | |
| use Cro::HTTP::Server; | |
| use Cro::Transform; | |
| # mixin for requests, carrying authentication info | |
| role AuthToy::Request::Authed { | |
| has Str $.user; |
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/env perl | |
| use strict; | |
| use warnings; | |
| use 5.020; | |
| use threads; | |
| sub run_child { | |
| my ($value) = @_; | |
| my $tid = threads->tid; |
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
| my @fizzes = (['','','Fizz'] xx *).flat; | |
| my @buzzes = (['','','','','Buzz'] xx *).flat; | |
| my @words = (@fizzes Z~ @buzzes); | |
| my @numbers = 1 .. *; | |
| my @fizzbuzz = (@numbers Z @words).map( *.max ); | |
| .say for @fizzbuzz[^20]; |
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::Spec; | |
| my $libdir; | |
| BEGIN { | |
| my ($vol,$dirs,$file) = File::Spec->splitpath(__FILE__); | |
| my @dirs = File::Spec->splitdir($dirs); | |
| my $lib_dirs = File::Spec->catdir(@dirs,'lib'); | |
| $libdir = File::Spec->catpath($vol,$lib_dirs,''); |
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/env perl | |
| use strict; | |
| use warnings; | |
| use 5.020; | |
| use experimental 'signatures'; | |
| my @span=(-1,-1); | |
| our $start=-1; | |
| # this regex matches a series of -, some non-dashes that do not match | |
| # 'some.{0,3}thing', and more dashes |