2010-03-14から1日間の記事一覧

Visit opcode tree with B

Test::Vars の解説を少しだけ。Perlの構文木を歩き回るには、B::walkoptree()かB::walkoptree_exec()を使う。基本的なやり方は以下の通りである。 #!perl -w use strict; use feature 'say'; use B; my $cv = B::svref_2object(sub{ $_[0] + 42 }); local *B…