Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use Modern::Perl;
use Benchmark qw(:all);
use Data::Dumper;
use HTML::String;
use Test::Deep::NoTest;
use Text::Xslate qw(mark_raw html_escape);
@bokutin
bokutin / gist:5966324
Created July 10, 2013 13:35
これならsqitchで、schemaもfixtureも管理できそうだ。。。かなり理想的な気がする。
use Modern::Perl;
use App::Sqitch;
use Graph::Easy;
sub run {
my $sqitch = App::Sqitch->new;
my $plan = $sqitch->plan;
my @changes = $plan->changes;
my $graph = Graph::Easy->new;
@bokutin
bokutin / validate-deep-01.pl
Last active February 24, 2019 05:27
またきちゃいましたバリデーション期。。。
#!/usr/bin/env perl
use sanity 'sane';
my $ok = {
var1 => 'foo',
var2 => 'bar',
var3 => 'baz',
items => [
{ subvar1 => 'foo' , subvar2 => 'bar' , } ,
@bokutin
bokutin / benchmark_validator.pl
Last active December 15, 2015 07:49
Validation::Class is slower than HTML::FormHandler.
package Simple::HFH {
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler';
has_field name => ( type => 'Text', required => 1 );
__PACKAGE__->meta->make_immutable;
}
package main {
use Mojo::Base -strict;
---
./config.pl: |
use Data::Dumper;
+{
name => "MojoApp",
};
mojo_app/lib/MojoApp.pm: |
package MojoApp;
use Mojo::Base 'Mojolicious';
@bokutin
bokutin / gist:3064740
Created July 7, 2012 04:42
build Alien::wxWidgets
もうちょっとAlien::wxWidgetsのビルドを速くしたい・・・
VMWareFusion 4, Windows XP SP3, Macbook Air 2012mid
Wxで計測
look Wx
perl Makefile.PL
timeit dmake -P# Event.o Wx.o GDI.o Constant.o Window.o Frames.o Controls.o
dmake clean
@bokutin
bokutin / mason.pl
Created May 26, 2012 16:53
気になっていたMasonのメソッドインポートについて。+Mojo::Templateの比較。
#!/usr/bin/env perl
use lib "/Users/bokutin/git/Foo/lib";
use Modern::Perl;
use IO::All;
use Mason;
my $seq = 0;
@bokutin
bokutin / gist:2659323
Created May 11, 2012 12:27
ScanSnapのPDFファイルがOCR済みかどうかチェックする
#!/usr/bin/env perl
use strict;
use feature ":5.10";
use CAM::PDF;
use Encode;
use Encode::UTF8Mac;
use IO::All;
$|=1;
use utf8;
use File::Spec;
use Win32::Unicode;
# フルパス = フォルダ名 + ファイル名
my $path = File::Spec->catfile("c:/Documents and Settings", "萌え♥.txt");
sayW $path; # C:\Documents and Settings\萌え♥.txt
# ファイルを作成してみる
my $file = Win32::Unicode::File->new(">", $path);
package Janken::Wx::App {
use strict;
use Wx;
use base "Wx::App";
sub OnInit {
my $self = shift;
my $frame = Janken::Wx::Frame->new;
$frame->Fit;