- Summary
Lingua::JA::Regular::Unicode を利用する。
Unicode::Japanese は重いらしい。
- Reference
TokuLog 改めB日記 - 2008-10-18 - Lingua::JA::Regular::Unicode というモジュールをつくりました
http://d.hatena.ne.jp/tokuhirom/20081018/1224300947
Lingua::JA::Regular::Unicode
- Summary
TT で utf8 のマルチバイト文字が化ける。
Template::Provider::Encoding で解決。
- Sample Source
use strict; use warnings; use utf8; use Template; use Template::Provider::Encoding; use Template::Stash::ForceUTF8; my $tt = Template->new( LOAD_TEMPLATES => [ Template::Provider::Encoding->new() ], STASH => Template::Stash::ForceUTF8->new, ); $tt->process('template.tt', $vars) || die $tt->error();
- Summary
CPANモジュールのインストール時に yes を選択するために
Enter を連打したくない。
- 方法1: 環境変数 PERL_AUTOINSTALL
export PERL_AUTOINSTALL='--defaultdeps'
- 方法2: cpan の prerequisites_policy オプション
$ cpan cpan> o conf prerequisites_policy follow cpan> o conf commit cpan> quit
| follow | 自動的にデフォルトを選択する |
| ask | ユーザに尋ねる |
| ignore | 無視する (依存モジュールのインストールを行わない) |
yes '' | cpan -i Some::Module
- Reference
CPANモジュールのインストール時に自動でデフォルト選択をする方法 - Craftworks Tech Blog - Branch
http://d.hatena.ne.jp/Craftworks/20090415/1239762931
CatalystやPlaggerのインストールでyes連打をしたくない - bokut.in
http://bokut.in/mt/2007/01/catalystplaggeryes.html
- Summary
$HOME/.cpan/CPAN/MyConfig.pm
'make_arg' => q[PREFIX=/home/user/local], 'make_install_arg' => q[PREFIX=/home/user/local], 'makepl_arg' => q[PREFIX=/home/user/local], 'mbuildpl_arg' => q[--install_base /home/user/local],
- Reference
openbooth - 2008-08-29 - 好きな場所に cpan モジュールをインストールする
http://openbooth.org/archives/17.html
- Summary
Perl で書かれた Terminal上で動作するTwitterクライアント。
- Clone URL
git://github.com/sugyan/Twiterm.git
- Reference
Terminal上で動作するTwitter閲覧ツール「Twiterm」を作った - すぎゃーんメモ
http://d.hatena.ne.jp/sugyan/20090928/1254069606
sugyan's Twiterm at master - GitHub
http://github.com/sugyan/Twiterm
- Reference
LWP::UserAgent::iTMS_Client
- Summary
� のような数値文字参照から元の文字に戻す方法.
- Encodeを使用する方法
#!/usr/bin/perl use strict; use warnings; use Encode; use utf8; binmode STDOUT, ":utf8"; my $a = "情報時代"; $a =~ s/&#x([0-9A-F]{4});/decode('UCS2', pack('H*', $1))/ge; print "$a\n";
my $a = "情報時代"; use HTML::Entities; print HTML::Entities::decode($a), "\n";
my $a = "情報時代"; $a =~ s/&#x([0-9A-F]{4});/chr(hex($1))/ge; print "$a\n";
- Reference
Welcome: YAPC::Asia 2008 - May 15-16th in Tokyo, JAPAN
http://conferences.yapcasia.org/ya2008/
- Reference
Perlで日付・時間を操作 - DateTime モジュールの使い方 (iandeth.)
http://iandeth.dyndns.org/mt/ian/archives/000619.html
- Reference
いやなブログ - スクリプト言語用のデバッガの使い方 - Ruby, Python, Perl
http://0xcc.net/blog/archives/000162.html
- via
www.textfile.org - スクリプト言語用のデバッガの使い方 - Ruby, Python, Perl
http://d.hatena.ne.jp/textfile/20070212/dbg
- Reference
naoyaのはてなダイアリー - coLinux 上の Emacs の kill-ring の内容をWindowsのクリップボードと同期する by Perl
http://d.hatena.ne.jp/naoya/20061125/1164466544
odz buffer - coLinux で Emacs の kill-ring の内容をWindowsのクリップボードと同期する
http://d.hatena.ne.jp/odz/20061125/1164433815
odz buffer - coLinux で Emacs の kill-ring の内容をWindowsのクリップボードと同期する #2
http://d.hatena.ne.jp/odz/20061125/1164437987
- Summary
Perlの行内差分取得モジュール.
- 文字列同士の差分を作って変更無い場所,変更が合った場所で配列を分けて作成.
my $diff = String::Diff::diff_fully('this is Perl', 'this is Ruby'); for my $line (@{ $diff->[0] }) { print "$line->[0]: '$line->[1]'\n"; } # u: 'this is ' # -: 'Perl' for my $line (@{ $diff->[1] }) { print "$line->[0]: '$line->[1]'\n"; } # u: 'this is ' # +: 'Ruby'
my $diff = String::Diff::diff('this is Perl', 'this is Ruby'); print "$diff->[0]\n";# this is [Perl] print "$diff->[1]\n";# this is {Ruby} my $diff = String::Diff::diff('this is Perl', 'this is Ruby',{ remove_open => '<del>', remove_close => '</del>', append_open => '<ins>', append_close => '</ins>', }); print "$diff->[0]\n";# this is <del>Perl</del> print "$diff->[1]\n";# this is <ins>Ruby</ins>
my $diff = String::Diff::diff_merge('this is Perl', 'this is Ruby'{ remove_open => '<del>', remove_close => '</del>', append_open => '<ins>', append_close => '</ins>', }); int "$diff\n";# this is <del>Perl</del><ins>Ruby</ins>
my $diff = String::Diff::diff_regexp('this is Perl', 'this is Ruby'); print "$diff\n";# this\ is\ (?:Perl|Ruby)
- Summary
Net::SSL::ExpireDateとTest::Baseを用いて,SSL証明書の期限切れをチェック.
#!/usr/bin/env perl # -*- mode: cperl; -*- use Test::Base; use Net::SSL::ExpireDate; use Regexp::Common qw(net); my $Check_Duration; # $Check_Duration = '15 years'; plan tests => 1 * blocks; run { my $block = shift; my $ed = Net::SSL::ExpireDate->new( build_arg($block->name) ); is($ed->is_expired($Check_Duration) && $ed->expire_date->iso8601, undef, $block->name); }; sub build_arg { my ($v) = @_; if ($v =~ m{^(file)://(.+)}) { return $1 => $2; } elsif ($v =~ m{^(https)://([^/]+)}) { return $1 => $2; } elsif ($v =~ m{^$RE{net}{domain}{-nospace}{-keep}$}) { return 'https' => $1; } elsif (-r $v) { return 'file' => $v; } else { croak "$v: assume file. but cannot read."; } } __END__ === rt.cpan.org === www.google.com
- Summary
use strict; use warnings; use utf8; use Lingua::JA::Summarize::Extract; my $extracter = Lingua::JA::Summarize::Extract->new; my $text = "日本語の文章を沢山書きます"; my $result = $extracter->extract($text); my $summary = $result->as_string; utf8::encode($summary); print $summary; #サマリーが出てくる.
- Summary
1. HTML::TreeBuilder で as_text
2. Text::MeCab で形態素解析
3. 名詞の頻度データを YAML に変換
4. HTML::TagCloud でタグクラウド化
- Reference
Japanese Prime Minister Speeches Tag Cloud - 日本の首相演説のタグクラウド
http://blog.bulknews.net/PMTagCloud/
日本の総理大臣の演説をタグクラウド化: blog.bulknews.net
http://blog.bulknews.net/mt/archives/002078.html
HTML::TreeBuilder
Text::MeCab
YAML
HTML::TagCloud
- Summary
。と゜は半角で
print if /[。-゜]/;
- Summary
Data::Dumperを卒業.
- Sample
use Dumpvalue; my $d = Dumpvalue->new(); # dumpValue $d->dumpValue($target); $d->dumpValue(\@target); # dumpValues $d->dumpValues($target1,$target2);
- Summary
TripletaiL とは,Linux+Apache+MySQL+Perl環境で
日本語のウェブアプリケーションを構築するためのオープンソースフレームワーク.
- Reference
TL - Perlフレームワーク
http://tripletail.jp/
- Summary
Perlからttyrecを扱うモジュール.
- SYNOPSIS
use Term::TtyRec::Player; use FileHandle; # $handle is any IO::* object my $handle = FileHandle->new('file.tty'); my $player = Term::TtyRec::Player->new($handle); # options can be set as hashref my $player = Term::TtyRec::Player->new($handle, { speed => 1, nowait => undef, });
- Summary
use lib 'path/to/lib'; use Foo;
use lib 'path/to/lib'; use Text::Iconv;