Skip to content

Instantly share code, notes, and snippets.

@kablamo
kablamo / handles.pl
Created Mar 20, 2018
Moo delegation example
View handles.pl
#!/usr/bin/env perl
package MyObject;
use Moo;
use Path::Tiny;
has file => (is => 'lazy', handles => [qw/slurp/]);
sub _build_file { path("./handles.pl") }
@kablamo
kablamo / perl testing synopsis.md
Last active Sep 9, 2015
perl testing talk description
View perl testing synopsis.md

The Perl test ecosystem

How to write tests in Perl. An exploration of CPAN test libraries.

Topics

Prove

  • Test directory layout
  • Test::More
  • TAP
@kablamo
kablamo / create_missing_spice_tests.pl
Created Feb 28, 2014
Create tests for example queries in DDG::Spice::* with no tests
View create_missing_spice_tests.pl
#!/usr/bin/env perl
use strict;
use warnings;
use v5.19.6;
use Class::Load ':all';
use Path::Tiny;
use PPI;
use List::AllUtils qw/first_index/;
@kablamo
kablamo / create_missing_goodie_tests.pl
Last active Aug 29, 2015
Create tests for example queries in DDG::Goodie::* with no tests
View create_missing_goodie_tests.pl
#!/usr/bin/env perl
use strict;
use warnings;
use v5.19.6;
use Class::Load ':all';
use Path::Tiny;
use PPI;
use List::AllUtils qw/first_index/;
@kablamo
kablamo / find_missing_tests.pl
Created Feb 3, 2014
This script finds all the example queries in the DDG::Goodie namespace and checks to see which ones are tested. The ones that are not tested are printed out.
View find_missing_tests.pl
#!/usr/bin/env perl
use strict;
use warnings;
use v5.10.1;
use Clone qw/clone/;
use DDP;
use List::AllUtils qw/first_index/;
use PPI;
@kablamo
kablamo / git-spark
Last active Dec 11, 2015
'git spark -days 30 Batman' gives you a sparkline graph of Batman's commit history over the last 30 days
View git-spark
#!/usr/bin/env perl
# Inspired by @trisweb:
# http://github.com/holman/spark/wiki/Wicked-Cool-Usage
use strict;
use warnings;
use Getopt::Long::Descriptive;
use Encode qw/encode decode/;
use DateTime;
View id_dsa.pub
ssh-dss AAAAB3NzaC1kc3MAAACBAKAkFkdwGP5EzpIq8FV//xIyY0SKTreYedyw82VeVIkxVh5H7NcyV6Qqea5cbm/jqC0/ycK2aWriRPJCCrNC/i8XerMd66dF5/vWYzJhvEHS7y5lIMgeg7qag4o1H60LPpaGxgqoOuR0AYwgf2UofQXwSncwPZzQ5N1TRO7+awHDAAAAFQD9pvu3jVbWcdw1lIJT/z8DN/AndQAAAIAwTrepDGQSwVpC0GVqNiEleOAl4WY6oBToFeavnS0k7zGQcmRE4WgL67G3sCxW1pgueD8OrcdMa6T7PRQnIIl9srU6t8c6ZuedfP92g1Fo6EiYGACBdbtSMqcY4qwqt6hsF0E6nYj7MG0XcTrmG3aikoSarVq2bR5rkZzSOLl+RAAAAIBy1V0pMClbIkc/ayRdgPfMid76IZaH64tyNt3HeQ16+f7lwCmfhfkeP/hZyJ3HPctpZ0AWAR+u9dk3xzsBBbwnoeHR3X2qZvuTZIGPLe9Jy6y72rFYKcMOw72IHa+ViHVM5Ccd9alvrOy2u+T5K6ms/rGTjzEyI/2wePIyye7/9A==
@kablamo
kablamo / repl.pl
Created Jan 5, 2011
$HOME/.re.pl/repl.rc
View repl.pl
use lib 'lib';
use feature qw(say);
use Term::ANSIColor;
no warnings 'redefine';
my @plugins = (
'ReadLineHistory', # history saved across sessions
'Colors', # colorize return value and errors
'FancyPrompt', # provide an irb-like prompt
You can’t perform that action at this time.