CPAN(包括的なPerlアーカイブネットワーク)の使用

CPANの使い方を学ぶ。

このタスクについて

CPANからPerlモジュールを追加するには、nzcpanコマンドを実行し、CPANアプリケーションコマンドを使用してモジュールをインストールする必要があります。 Netezzaアナリティクスパッケージをインストールしたら、CPANでホストとSPUをセットアップし、テスト用のモジュールをインストールします。

手順

  1. コマンドラインから 'nzcpan host を実行する。
    コマンドを実行したことがない場合は、コマンドが選ぶデフォルトを受け入れる。
    [nz@host]$ nzcpan host
  2. cpanプロンプトから以下のコマンドを実行する。
    install String::Util
    コマンドが完了するまで待つ。
  3. コマンドラインから「nzcpan spu実行する。
    コマンドを実行したことがない場合は、コマンドが選ぶデフォルトを受け入れる。
    [nz@host]$ nzcpan spu
  4. cpanプロンプトから以下のコマンドを実行する。
    force install String::Util
    この場合、CPANリソースは共有されているので、'force使わなければならない(ただし、Perl用のパスは異なる)。
  5. インストールが完了したら、「nzcpan終了し、以下のAEを作成する。
    #########################################################################
    package Unquote;
    use nzae::Ae;
    use strict;
    use String::Util ':all';
    use autodie;
    our @ISA = qw(nzae::Ae);
    my $ae = Unquote->new();
    $ae->run();
    sub _getFunctionResult(@)
    {
    my $self = shift;
    # BREAK APART OUR ROW OF INPUT.
    my $str = $_[0];
    return unquote($str);
    }
    1;
    #########################################################################
  6. 以下の方法でプログラムをコンパイルし、登録する。
    commands:/nz/export/ae/utilities/bin/compile_ae --language perl --version 3
    --template deploy Unquote.pm
    /nz/export/ae/utilities/bin/register_ae --language perl --version 3 --template
    udf --exe Unquote.pm --sig "unquote(varchar(10000))" --return "varchar(10000)"
    --level 4
  7. インストール後のシステムをテストします。
    [nz@host]$ nzsql
    例:
    [nz@host]$ nzsql
    Welcome to nzsql, the IBM Netezza SQL interactive terminal.
    Type: \h for help with SQL commands
    ? for help on internal slash commands
    \g or terminate with semicolon to execute query
    \q to quit
    SYSTEM(ADMIN)=> select unquote('"hello"');
    UNQUOTE
    hello
    (1 row)