Skip to content

Instantly share code, notes, and snippets.

View autarch's full-sized avatar

Dave Rolsky autarch

View GitHub Profile
@autarch
autarch / gist:cdb2c3b71a7c7f4c0a93
Created May 4, 2015 18:20
Bash script to rename a Perl package in a git repo (doesn't actually move the package though)
#!/bin/bash
set -e
if [[ $# == 2 ]]; then
DIR=.
OLD=$1
NEW=$2
else
DIR=$1
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWUPSTREAM=auto
function __my_git_ps1 {
SV *_info_from_handle(self, handle)
SV *self
SV *handle
PREINIT:
magic_t magic;
PerlIO *io;
int fd;
const char *description;
const char *mime;
package Foo;
use v5.16;
use Moose;
use overload q{""} => '_stringify';
sub _stringify { 42 }
say Moose->VERSION;
@autarch
autarch / gist:de572363115de4239b3a
Last active August 29, 2015 14:07
Proposed API for better overload support in Moose
=pod
=head1 NAME
Moose Overloading - Design sketch for better overloading support in Moose
=head1 SYNOPSIS
# These are Class::MOP::Overload objects
for my $overload ( $meta->get_all_overloaded_operators() ) {
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
Platform:
osname=linux, osvers=2.6.32-38-server, archname=x86_64-linux
uname='linux ci1-wdc 2.6.32-38-server #83-ubuntu smp wed jan 4 11:26:59 utc 2012 x86_64 gnulinux '
config_args='-des -Accflags=-fPIC -Dprefix=/opt/perl5.16.3'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
TestFor::MM::minFraud::Device::Risk->test_startup() failed: error populating HighRiskIPAddress in maxmind database - Operation "ne": no method found,
left argument in overloaded package JSON::PP::Boolean,
right argument in overloaded package JSON::PP::Boolean at .../lib/perl5/DBIx/Class/Row.pm line 414.
Trace begun at .../lib/MM/Databases/Populator.pm line 170
MM::Databases::Populator::__ANON__('MM::Exception::InflatedString=HASH(0x5d765eb0)') called at .../lib/perl5/Try/Tiny.pm line 100
Try::Tiny::try('CODE(0x5d6ead78)', 'Try::Tiny::Catch=REF(0x5d7656a0)') called at .../lib/MM/Databases/Populator.pm line 174
MM::Databases::Populator::_populate_from_data_set('MM::Databases::Populator=HASH(0x5d763120)', 'HighRiskIPAddress', 'HighRiskIPAddress') called at .../lib/MM/Databases/Populator.pm line 139
MM::Databases::Populator::__ANON__ at .../lib/perl5/DBIx/Class/Storage/BlockRunner.pm line 140
DBIx::Class::Storage::BlockRunner::__ANON__ at .../lib/perl5/Try/Tiny.pm line
[ failed: Operation "eq": no method found,] [Test Output]
left argument in overloaded package JSON::PP::Boolean,
right argument in overloaded package JSON::PP::Boolean
autarch@houseabsolute:~/projects/Dist-Zilla-Plugin-Conflicts (master *=)$ prove -lv t/01-basic.t
t/01-basic.t ..
ok 1 - build proceeds normally
ok 2 - prereqs are injected
ok 3 - conflicts module created
ok 4 - no trailing whitespace in generated module
ok 5 - module content looks good
ok 6 - conflicts script created
ok 7 - no trailing whitespace in generated script
ok 8 - script content looks good
@autarch
autarch / podtogo.pl
Last active August 29, 2015 14:05 — forked from tsibley/podtogo.pl
#!/usr/bin/env plackup
use strict;
use warnings;
use utf8;
use HTML::Restrict;
use Plack::Builder;
use Plack::App::Directory;
use lib::remote 'MetaCPAN::Pod::XHTML' =>