APIスクリプトを動かすには?

以前、「Understand API」を紹介しました。
その中でサンプルスクリプトが提供されていることにも触れましたので、今回は早速、サンプルのPerlスクリプトを使って「API スクリプトを実行する方法」をご紹介したいと思います。

サンプルスクリプトは「%Understandインストールフォルダ%samplescripts」に格納されています。今回は、前回の最後にも取り上げた各関数の複雑度を出力するスクリプト 「ac_complexitymetrics.pl」を例に、スクリプトを実行してみます。

Perlのスクリプトの実行には uperl というPerlのラッパーコマンドを使い、コマンドラインから実行します。uperlコマンドは「%Understandインストールフォルダ%binpc-win32」にあります。

[実行例]
> uperl ac_complexitymetrics.pl -db fastgrep.udb

Function/Procedure  Complexity  Essential    Knots  EssentialKnots
regmatch                    51         30      335             335
main                        44          4       88               5
regatom                     27         17       94              94
chimaera                    18         10       14              14
gotamatch                   15          4        8               4
multiple                    14          1        1               0
alternate                   14          8        9               9
reg                         14          9       12              12
regexec                     13         13       15              15
regsub                      12          7       12              10
regcomp                     12          6        6               5

上記のサンプルスクリプト以外にも様々なスクリプトが用意されています。是非とも一度、お試しください。

タイトルとURLをコピーしました
Close Bitnami banner
Bitnami