詩と創作・思索のひろば

ドキドキギュンギュンダイアリーです!!!

Fork me on GitHub

Perl

LWPで"dh key too small"ってなったときの対処

ひさびさに Perl の話。結構前のことだけど、OS のバージョンを Debian 10 (Buster) にしたら LWP で一部のサイトにアクセスできなくなってしまった。 500 Can't connect to ***.com:443 (SSL connect attempt failed error:141A318A:SSL routines:tls_proce…

Router::Simple::Reversible という Perl モジュールを書いた

https://metacpan.org/pod/Router::Simple::Reversible だいぶ昔に書いていたのを shipit しました。tokuhirom さんの Router::Simple に、いわゆるリバースルーティングを足しただけのモジュール。Router::Simple を継承しているので、bless しなおすなりし…

Shipped ARGV::JSON 0.01

English entry is here. ARGV::JSON というモジュールをリリースいたしました。Perl では <> という特殊な演算子で、プログラム引数として与えられたファイルやら標準入力やらをよしなに読み込むことができます(デフォルトだと行ごと)が、この ARGV::JSON …

ARGV::JSON - easy JSON handling in one-liners #perl

To manipulate JSON data with perl-oneliner I have been writing like this: % perl -MJSON -0 -E 'say decode_json(<>)->{foo}' data.json ... which tires my fingers. Recently I found ARGV::URL, which may be useful for one-liners, so I wrote the…

いい感じに出力をインデントしてくれるモジュール #perl

[2013-11-20: Print::IndentedがCPANになくてしょんぼりしている。 とのことで shipit いたしました。 あざーす!] 過去のよく分からないコードの挙動を把握したいときには print (warn) するのが少なくともとりあえずの方法としては常套手段ですが、これが…

自動で cpanfile を記述する試み

[2013-10-31 追記] tokuhirom ちなみに静的解析でいい場合は scan-prereqs-cpanfile がつかえますね。 http://b.hatena.ne.jp/tokuhirom/20131030#bookmark-167207818 おお、顧客が本当に必要だったものはこれですね! ありがとうございます! 適当に書きあ…

To avoid "Wide character in print" warnings in Test::More

The Problem use utf8; use strict; use warnings; use Test::More; pass 'L( ◔ω◔)┘三└( ◔ω◔)」'; subtest 'foo' => sub { pass 'L( ◔ω◔)┘三└( ◔ω◔)」'; }; done_testing; Wide character in print at /Users/motemen/.plenv/versions/5.14.2/lib/perl5/5.14…

To install Math::BigInt::GMP with homebrewed GMP

The Problem % cpanm -v Math::BigInt::GMP cpanm (App::cpanminus) 1.7000 on perl 5.014002 built for darwin-2level Work directory is /Users/motemen/.cpanm/work/1381980252.48465 You have make /usr/bin/make You have LWP 6.05 You have /usr/bin/t…

Shipped AnyEvent::Plackup

https://github.com/motemen/AnyEvent-plackup (Japanese entry at http://subtech.g.hatena.ne.jp/motemen/20120920/1348138250) Simple obvious usage use AnyEvent::Plackup; my $server = plackup(app => \&psgi_app, port => $port); say $server; # st…

パール、アナルを使え!または私は如何にして Perl のワンライナーを書けるようになったか

簡単に言うとこういうことです。今日はこれだけ覚えて帰ってください。 perl -anal -e "…" 同様のオプションは Ruby でも使えます。 解説 -a いきなり見かけないオプションですが、入力を空白文字で区切り、@F という配列に入れてくれます。それ以外の影響は…

Released Class::Accessor::Lite::Lazy 0.03

Class-Accessor-Lite-Lazy-0.03 - Class::Accessor::Lite with lazy accessor feature - metacpan.org - Perl programming language By default, the builder method name for an attribute $attr is named "_build_$attr". You can specify the builder met…

Installing Term::ReadLine::Gnu with Homebrewed readline by cpanminus v1.7

Before 1.7 Support passing arguments to configure, build, test and install with —configure-args etc. App-cpanminus-1.7000 - get, unpack, build and install modules from CPAN - metacpan.org - Tatsuhiko Miyagawa's blog (σ^д^)σ Now you can ins…

auto-insert package skeleton on a new .pm file

" .vimrc augroup pm-autoinsert-package autocmd! autocmd BufNewFile *.pm call append(0, [ \ 'package ' . fnamemodify(expand('%'), ':r:s.^lib/..:gs./.::.') . ';', \ 'use strict;', 'use warnings;' \ ]) \ | call append(line('$'), '1;') \ | set…

Parsing JSON input and inspecting in a REPL

When you are to inspect a JSON, if you are already familier with its format, using jq may be a solution. But if you don't know its structure well? A REPL-way would be handy. Using Reply, in .replyrc: ; .replyrc script_line5 = sub j { our $…

Installing Term::ReadLine::Gnu with Homebrewed readline

[2013-09-05] Now cpanminus 1.7 is out and below is old-dated. Check out here. The Problem % cpanm Term::ReadLine::Gnu --look --> Working on Term::ReadLine::Gnu Fetching http://www.cpan.org/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-1.20.tar…

はてなで一緒に働きませんか?