- 追加された行はこのように表示されます。
- 削除された行は
このように表示されます。
*アルバムCGI
!!!参考サイト
!Perl、ImageMagick、MPlayer を使ってモザイク・ムービーを作成する / IBM developerWork
*http://www-06.ibm.com/jp/developerworks/opensource/060825/j_os-mosperl.shtml
!MIME::Parser - メールの解析
*http://www.ksknet.net/cat28/mimeparser.html
""MIME::Parserはメールを解析し、ヘッダーや添付などを取り出してくれるモジュールです。
""ただし添付ファイルに日本語が含まれるファイルはうまく動きませんので注意
*メールの添付ファイル取り出しサンプル
!perl TERMINAL 判定 / stackoverflow
*http://stackoverflow.com/questions/3517250/how-do-i-detect-if-stdout-is-connected-to-a-tty-in-perl
""Use the -t filetest operator.
print -t STDOUT ? "Yes\n" : "No\n"
!Wide character in print at ... / ksknet
*http://www.ksknet.net/perl/wide_character.html
""Wide character in print atというエラーはUTF-8フラグが付いた文字列をprintしようとしているからである。なのでUTF-8フラグを取り外してからprintすればエラーがでなくなります。UTF-8フラグが付いているかどうかはutf8::is_utf8を使用すればよい。
#UTF8フラグが付いているかの確認
print utf8::is_utf8($string) ? 'flagged' : 'no flag';
""UTF-8フラグが付いていたら、encodeを使用してフラグをはずします。以下の例では$stringをutf-8に変換して出力します。
print encode('utf-8', $string);
!!!自分流
!テキストファイルの頭に行番号を入れる
perl -pe 'print "$. ";' < httpd.conf
*結果
1 #
2 # Based upon the NCSA server configuration files originally by Rob McCool.
3 #
4 # This is the main Apache server configuration file. It contains the
5 # configuration directives that give the server its instructions.
...(以下略)