Perl には Test::Class という JUnit 風にテストを書けるモジュールがある。すなわち: テスト用のクラスを定義し アサーションをインスタンスメソッドとして括り出す ことができる。 Test::Class はテスト実行時に環境変数 TEST_METHOD に与えられた値で実行するテストメソッドをフィルタリングすることができる。 Sometimes you just want to run a single test. Commenting out other tests or writing code to skip them can be a hassle, so you can specify the TEST_METHOD environment variable. The value is expected to be a valid regular expres
readline って言うと、便利な反面 Windows だと問題が多く発生して、Windows でも動かすスクリプトでの使用は敬遠してたんですが、Caroline だと多い日も安心。 tokuhirom/Caroline - GitHub Yet another line editing library https://github.com/tokuhirom/Caroline readline なんかと違って、内部は utf-8 なので unix 等のスクリプトと同じ動きをします。ヒストリも保存出来るし、入力補完も自作出来ます。 eg/suddenly_death.pl を見るといいです。 $ perl -Ilib eg/suddenly_death.pl hello> ここで m を入力してタブキーをタイプすると... $ perl -Ilib eg/suddenly_death.p
Perlのテスト実行するときproveとかやると何か結果が出るけど,これの出力するのをプログラムから操作したいと思って,TAP::Harness読んでた. TAP::Harnessのコンストラクタに自作のformatter_class(これはテストが終わったときに結果を整形するクラス)を渡して,formatte_classのopen_testの返り値で自作のSessionクラス(これは一行ずつ呼ばれるやつ)を渡すと,Sessionクラスのresultに各行のオブジェクトがやってくることが分かった.merge => 1すると テスト失敗したときに構造化されずに出てくる# Failed test みたいなのもSessionで受け取れる.必要な分だけ書きたいのでデフォルトのクラスを継承してちょっとだけ書く. 意味ないけど,とりあえず,出力が左右判定するproveみたいなの作っておいた.これ自体に
Perl 5.16.3 has just been released including the fix for the Rehashing flaw and is a recommended update for all 5.16 users. Perl 5.14.4 has also been released, again fixing the Rehashing Flaw and is a recommended update for all 5.14 users. These updates will be mirrored to your local CPAN mirror in the next few hours.
Readme Dependencies This game is written in Perl language, so it depends on Perl interpreter. It also needs libtermkey and some extra Perl modules: Term::ReadKey Term::TermKey POE POE::Wheel::TermKey If you don't know how to install Perl modules, look at How to install CPAN modules. If you have problems with installation of Term::TermKey, make sure that libtermkey is available in your operating sy
生のハッシュリファレンスを return したら遅い コメントを残せないブログなんて!どうなの!と、それは置いておいて、Perlでconstant foldingされるのは文字列・数値リテラルか、定数扱いできる関数だけです。 定数扱いできる関数というのは実は決まっていて、以下の条件がそろわないとconstant folding されない: その関数は 引数を取らない、とprototypeで明示的に宣言してあるその関数は文字列・数値リテラルを返し、それ以外の処理を行わないこちらのコードを実行してみるとわかりやすいuse strict; use O ('Deparse'); sub not_const { 1 } sub const_num() { 1 } sub const_string() { "foo" } sub const_list() { [ qw(1 2 3) ] } sub
ハッシュリファレンスは畳み込み的に定数扱いじゃなかったのね、ってのに気づいて驚いた(というのが本当に遅い原因か確定させて無いけど)(【追記2】参照)。 #!/usr/bin/perl use strict; use warnings; use Benchmark qw/timethese cmpthese/; my $HASH = { foo => 123, bar => 456, baz => 789, }; my $result = timethese (750_000, { 'VAL' => '&logic1;', 'RAW' => '&logic2;', }); cmpthese $result; sub logic1 { _logic1()->{foo}; } sub _logic1 { return $HASH; } sub logic2 { _logic2()->{foo};
※注 タイトルに深い意味はありません https://github.com/toritori0318/p5-Yogafire だいぶ前からgithubには置いてたんですが 年始だしドキュメントっぽいのを書いてみることにしました。 超長い!でも便利かも! 前置き 仕事上AWS(EC2)を使うことが多いのですが、 自分で使っていて「こんなんあったら便利かなー」というのを寄せ集めたCLIです。 基本的な考え方としては「EC2をタグNameベースで」いろいろと操作できるようなツールですね。*1 *2 貧乏性な自分はスポットインスタンスを定常的に使うので yoga sshは割と必須だったりしています。 ※Windows たぶん動きません! インストール cpanm https://github.com/toritori0318/p5-Yogafire/tarball/master # cpanm無い
Mail::Krohn is alternative library for Email::Sender. I don't want to use Email::Sender since it depends on Moose. I want to run our application in tight memory. Some of the developers call the sendmail command by himself. Mail::Krohn is minimized version of Email::Send. But all required features for most web applications are supported(I hope). Enjoy! 【追記】 Now, Email::Sender was switched to Moo. I
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く