memo.xight.org

Home > Changelogメモ > Perl > 3ページ目 (全6ページ)
ChangeLog 最新ページ / カテゴリ最新ページ / 前ページ 1 2 3 4 5 6 次ページ / 3ページ目 (全6ページ)
2008-12 / 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

2006-01-04 Wed

Term::ANSIColor

- Summary
コンソール上で色付けした文字を扱うためのPerlモジュール.
これは便利!

- Sample

#!/usr/bin/perl
use strict;
use warnings;
use Term::ANSIColor qw(:constants);
 
$Term::ANSIColor::AUTORESET = 1;
 
print BOLD RED   "RED\n";
print BOLD GREEN "GREEN\n";
print BOLD BLUE  "BLUE\n";


- Reference
Term::ANSIColor

- via
naoyaのはてなダイアリー - 無線LANブリッジのIPアドレスを探せ
http://d.hatena.ne.jp/naoya/20051231/1135992917

カテゴリ: [Perl]
内部リンク: [2006-01-19-3]

2005-12-22 Thu

サニタイズの基本

- SQLインジェクション

MySQL PHP $sql = mysql_escape_string($sql);
MySQL Perl $sql =~ s/'/''/g; $sql =~ s/\\/\\\\/g;
PostgreSQL PHP $sql = pgsql_escape_string($sql);
PostgreSQL Perl $sql =~ s/'/''/g; $sql =~ s/\\/\\\\/g;
SQLite PHP $sql = sqlite_escape_string($sql);

- OSインジェクション
Linux PHP $str = escapeshellarg($str);
Linux Perl $str =~ s/'/\\'/g;

- XSS
PHP $str = htmlspecialchars($str);
Perl $str =~ s/</</g;

- Reference
入門 Ajax: 本 - pp.16

カテゴリ: [PHP][Perl]

2005-12-09 Fri

入力行に時刻を付けて吐き出すフィルタ

- Source

#!/usr/bin/perl
use strict;
use warnings;
use POSIX qq(strftime);
$| = 1;
while (defined(my $line = <>)) {
	print strftime('%Y/%m/%d %H:%M:%S ', localtime), $line;
}

- Usage

% ping localhost | puttime
2005/12/09 02:16:08 PING localhost (127.0.0.1): 56 data bytes
2005/12/09 02:16:08 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.0 ms
2005/12/09 02:16:09 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.0 ms
2005/12/09 02:16:10 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.0 ms
2005/12/09 02:16:11 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.0 ms
2005/12/09 02:16:12 64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.0 ms

- Reference
スペースモラトリアムノカミサマ - 2005-12-05 - 入力行に時刻を付けて吐き出すフィルタ
http://pmakino.jp/tdiary/20051205.html#p01
- via
cl.pocari.org - 2005-12-06 - 入力行に時刻を付けて吐き出すフィルタ
http://cl.pocari.org/2005-12-06-7.html

カテゴリ: [Perl]

2005-12-02 Fri

JavaScript::Swell - JavaScript のソースコードを整形

- Reference
JavaScript::Swell

- via
cl.pocari.org - 2005-11-27 - JavaScript のソースコードを綺麗に整形してくれる Perl モジュール JavaScript::Swell
http://cl.pocari.org/2005-11-27-3.html

YappoLogs: JavaScript::Swell - Web2.0 時代のHackモジュール
http://blog.yappo.jp/yappo/archives/000343.html

カテゴリ: [Perl][JavaScript]

2005-11-30 Wed

XML::Simple での XML::SAX

- Summary
・ 環境変数 "XML_SIMPLE_PREFERRED_PARSER",またはパッケージ変数 "$XML::Simple::PREFERRED_PARSER" で利用するパーサーを指定可能
・ これら設定が undef の場合,XML::SAX を優先的に使用
・ これら設定は初期状態では undef
・ XML::SAX が内部的に利用するパーサーはユーザが最後にインストールしたSAXパーサーになる

$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
と書くと,XML::Parser が使われる

- Reference
search.cpan.org: XML::Simple - Easy API to maintain XML (esp config files)
http://search.cpan.org/%7Egrantm/XML-Simple-2.14/lib/XML/Simple.pm#ENVIRONMENT

iandeth. - XML::Simple は遅い説における意外な落とし穴
http://iandeth.dyndns.org/mt/ian/archives/000589.html

- via
Sledge::Plugin::TokuLog! - 「XML::Simple は遅い説における意外な落とし穴」について
http://d.hatena.ne.jp/tokuhirom/20051130/1133306919

カテゴリ: [Perl][XML]

2005-11-18 Fri

grep演算子でコードの密度を高める

- Reference
CMS researcher - Perl: grep演算子でコードの密度を高める
http://d.hatena.ne.jp/ysano2005/20051112/1131752097

カテゴリ: [Perl][Stub]

2005-11-17 Thu

Acme-Web20-Validator

- Reference
Acme::Web20

naoyaのはてなダイアリー - Acme::Web2dot0::Validator
http://d.hatena.ne.jp/naoya/20051113/1131906445

カテゴリ: [Perl][ネタ][Stub]

2005-11-08 Tue

気になるCPANモジュール

- Reference
気になるCPANモジュール : NDO::Weblog
http://naoya.dyndns.org/~naoya/mt/archives/000612.html

カテゴリ: [Perl][Stub]

2005-09-26 Mon

Text::ASCIITable - 人間フレンドリーな表組み出力

- Reference
MFPM: Text::ASCIITable 人間フレンドリーな表組み出力
http://e8y.net/blog/2005/09/16/p88.html

Text::ASCIITable

- via
cl.pocari.org - 2005-09-24
http://cl.pocari.org/2005-09-24-3.html

カテゴリ: [Perl][Stub]

2005-09-26 Mon

backuper.pl

- source

#!/usr/bin/env perl
use Date::Simple ('date','today');
 
my $HOME = q(/path/to/home);
my $BACKUP_DIR = $HOME.q(/backup);
my $tar = q(/bin/tar);
 
$date = today();
 
# print "$tar czvf $HOME/$date.tar.gz $HOME/public_html $HOME/work\n";
`$tar czvf $BACKUP_DIR/home-$date.tar.gz $HOME/public_html $HOME/work`;
`$tar czvf $BACKUP_DIR/www-$date.tar.gz /var/www`;

カテゴリ: [Perl][Stub]

2005-09-15 Thu

配列操作の比較表 (Ruby, Python, JavaScript, Perl, C++)

- Reference
いやなブログ: 配列操作の比較表: Ruby, Python, JavaScript, Perl, C++
http://namazu.org/~satoru/blog/archives/000043.html

あーありがち - Ruby と PHP の配列操作比較
http://aligach.net/diary/20050829.html

カテゴリ: [Perl][PHP][Ruby][Python][JavaScript][C++]

2005-09-03 Sat

ppencode , rrencode

- Summary
ppencode は JAPH (Just Another Perl Hacker)を支援するソフトウェア

- Reference
ppencode - JavaScript demo
http://namazu.org/~takesako/ppencode/demo.html

- via
www.textfile.org - 2005-09-02
http://www.hyuki.com/t/200509.html#i20050902174958

カテゴリ: [Memo][Perl][ネタ]

2005-08-12 Fri

Net::DNS

- Install

# aptitude install libnet-dns-perl


- nslookuper.pl

#!/usr/bin/perl
use Net::DNS;
my $res   = Net::DNS::Resolver->new;
while (<>){
	chomp;
	my $host  = $_;
	my $query = $res->search($host);
 
	if ($query) {
		foreach my $rr ($query->answer) {
			next unless $rr->type eq "A";
			my $address = $rr->address;
			printf("%-20s : %14s\n" ,$host,$address);
		}
	} else {
		warn "query failed: ", $res->errorstring, "\n";
	}
}

- usage

$ cat list
www.example.com
www.exmaple.net
www.example.org
$ nslookuper.pl < list
www.example.com : 192.0.34.166
www.example.net : 192.0.34.166
www.example.org : 192.0.34.166


- Reference
Net::DNS

カテゴリ: [Perl]

2005-08-12 Fri

Perl関数リファレンス

- Reference
  Smart! - Perl講座 - Perl関数一覧
  http://www.rfs.jp/sitebuilder/perl/05/

カテゴリ: [Perl]
2008-12 / 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
最終更新時間: 2008-12-02 10:52

Color Reference

ChangeLogを検索
携帯電話からアクセス!

カテゴリ

最近の話題

リンク

過去ログ

Google

QR Code

Since
2002-11-28
Update
2008-12-02 10:52
Copyright © 2005 xight.org All Rights Reserved.