Perlで参考になったサイト一覧

Perl文法

Perl Hackers Hub:連載|gihyo.jp … 技術評論社
正規表現パズル
2005-08-09 - naoyaのはてなダイアリー

Perlでコマンド実行した標準エラーを読み取る

Perlで実行した外部コマンドの標準エラーを表示する方法。
作成したかったのは、各サーバをクロールして各サーバのcrontab -lを読み取って画面に出力するCGI.

#!/bin/perl

use strict;
use warnings;

my $result = `crontab -l 2>&1`;
print $result;

perlのパターンマッチ

perlのパターンマッチで知らなかったのでメモ。

複数条件を書く時は
{$_ =~ /.*aaa/ | $_ =~ /.*bbb/ }
で書けるらしい。
*追記
perldoc perlrequickのMatching this or thatにすべて書いてあった。
やっぱり原文ドキュメントを読むのは大事だ。
|はalternationというらしい。

手作業によるモジュールのインストール

  • インストール方法
  • ローカルにインストールしたモジュールの利用方法

続・初めてのPerl 改訂第2版
2.8.1 CPANminus
2.8.2 手作業によるモジュールのインストール

1.CPANでお好みのモジュールを見つける

http://search.cpan.org/

2.CPANからwgetしてから解凍まで
wget http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz
tar xzf DBD-Oracle-1.74.tar.gz
cd DBD-Oracle-1.74
perl Makefile.PL
make			//
make test		//
make install		//
perldoc perllocal	//
[appadm@www15195ui DBD-Oracle-1.74]$ perl Makefile.PL
Multiple copies of Driver.xst found in: /home/appadm/perl5/lib/perl5/x86_64-linux-thread-multi/auto/DBI/ /usr/lib64/perl5/auto/DBI/ at Makefile.PL line 39.
Using DBI 1.628 (for perl 5.010001 on x86_64-linux-thread-multi) installed in /home/appadm/perl5/lib/perl5/x86_64-linux-thread-multi/auto/DBI/

Configuring DBD::Oracle for perl 5.010001 on linux (x86_64-linux-thread-multi)

Remember to actually *READ* the README file! Especially if you have any problems.

Installing on a linux, Ver#2.6
Using Oracle in /u01/app/oracle/product/11.2.0/xe
DEFINE _SQLPLUS_RELEASE = "1102000200" (CHAR)
Oracle version 11.2.0.2 (11.2)
Found /u01/app/oracle/product/11.2.0/xe/rdbms/demo/demo_xe.mk
Using /u01/app/oracle/product/11.2.0/xe/rdbms/demo/demo_xe.mk
Looks like Oracle XE (/u01/app/oracle/product/11.2.0/xe/rdbms/demo/demo_xe.mk)
Reading /u01/app/oracle/product/11.2.0/xe/rdbms/demo/demo_xe.mk
Your LD_LIBRARY_PATH env var is set to ''
WARNING: Your LD_LIBRARY_PATH env var doesn't include '/u01/app/oracle/product/11.2.0/xe/lib' but probably needs to.

client_version=11.2


DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"11.2.0.2\" -DORA_OCI_102 -DORA_OCI_112


Checking for functioning wait.ph


System: perl5.010001 linux c6b8.bsys.dev.centos.org 2.6.32-220.el6.x86_64 #1 smp tue dec 6 19:48:22 gmt 2011 x86_64 x86_64 x86_64 gnulinux
Compiler:   gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
Linker:     /usr/bin/ld
Sysliblist: -ldl -lm -lpthread -lnsl -lirc
Oracle makefiles would have used these definitions but we override them:
  CC:       /usr/bin/gcc
  LDFLAGS:  -g
           [-g]
Linking with -L/u01/app/oracle/product/11.2.0/xe/lib/ -lclntsh -lpthread

Checking if your kit is complete...
Looks good
LD_RUN_PATH=/u01/app/oracle/product/11.2.0/xe/lib
Using DBD::Oracle 1.74.
Using DBD::Oracle 1.74.
Multiple copies of Driver.xst found in: /home/appadm/perl5/lib/perl5/x86_64-linux-thread-multi/auto/DBI/ /usr/lib64/perl5/auto/DBI/ at Makefile.PL line 1789.
Using DBI 1.628 (for perl 5.010001 on x86_64-linux-thread-multi) installed in /home/appadm/perl5/lib/perl5/x86_64-linux-thread-multi/auto/DBI/
Generating a GNU-style Makefile
Writing Makefile for DBD::Oracle
Writing MYMETA.yml and MYMETA.json

***  If you have problems...
     read all the log printed above, and the README and README.help.txt files.
     (Of course, you have read README by now anyway, haven't you?)

***