perl 5 まとめウィキ

タグ検索でcpan19件見つかりました。

Term::ProgressBar

&fukidashi(tomyhero){時間のかかるバッチ処理なケースに使用すると楽しくなります。} * サンプルコード =|PERL| #!/usr/bin/perl use Term::ProgressBar ; use constant MAX => 100; my $progress = Term::ProgressBar->new(MAX); my $cnt = 0; for (0..MAX) { $cnt++ ; if( $cnt == 10 ) {…

https://seesaawiki.jp/w/perl5/d/Term%3a%3aProgress... - 2009年07月06日更新

Scalar::Alias

&fukidashi(tomyhero){変数にAliasを張っちゃえる。本来値で取る書き方で、refを取れる的な感じのようです。} * scalarの引数の値を変更するケースのベンチマーク =|PERL| #!/usr/bin/perl use warnings; use strict; use Scalar::Alias; use Benchmark qw/cmpthese/; sub append { my $text = shift; $$text .= "HOGE\n";…

https://seesaawiki.jp/w/perl5/d/Scalar%3a%3aAlias... - 2009年06月06日更新

Devel::Size

&fukidashi(tomyhero){変数が使用しているメモリ量をしらべることができます。} =|PERL| #!/usr/bin/perl use warnings; use strict; use Devel::Size qw(total_size size); my $ref ={ hoge => 'hogehoge' , hage => 'hageghe' }; printf("%d\n", size ( $ref )); printf("%d\n" , total_s…

https://seesaawiki.jp/w/perl5/d/Devel%3a%3aSize... - 2009年04月13日更新

Class::Method::Modifiers::Fast

&fukidashi(tomyhero){関数を拡張できる、スーパー便利なモジュール。パフォーマンスが気になる所} * 例 =|PERL| #!/usr/bin/perl use warnings; use strict; use Class::Method::Modifiers::Fast; sub original { print "i am original\n"; }; before original => sub { print "i am before\n" }; after…

https://seesaawiki.jp/w/perl5/d/Class%3a%3aMethod%... - 2009年01月31日更新

Class::Method::Modifiers

&fukidashi(tomyhero){関数が拡張できるモジュール。Class::Method::Modifiers::Fast がXSで実装されていて早いっぽい。} * 例 =|PERL| #!/usr/bin/perl use warnings; use strict; use Class::Method::Modifiers; sub original { print "i am original\n"; }; before original => sub { print "i…

https://seesaawiki.jp/w/perl5/d/Class%3a%3aMethod%... - 2009年01月31日更新

Module::ExtractUse

&fukidashi(tomyhero){useしてるモジュールの一覧を取ってくれるよ} *サンプル =|PERL| #!/usr/bin/perl use Data::Dumper; use Module::ExtractUse; my $p= Module::ExtractUse->new; $p->extract_use('/home/tomyhero/app/angelos/angelos-core/lib/Angelos.pm'); warn Dumper $p->arra…

https://seesaawiki.jp/w/perl5/d/Module%3a%3aExtrac... - 2009年01月30日更新

Storable

* dclone deep cloneかな。 =|PERL| #!/usr/bin/perl use warnings; use strict; use Storable qw/dclone/; use Data::Dumper; my $dd = 'foo'; my %a = ( hoge => { hage => [ 1 ,2 ] } , dd => \$dd ); my $b = dclone(\%a); my %c = %a; $a{a} = 1; $dd = …

https://seesaawiki.jp/w/perl5/d/Storable... - 2009年01月23日更新

Kwalify

&fukidashi(tomyhero){データ構造のスキーマを定義し、検証することができる。設定ファイル記入のエラーを未然に防いだりなど、使う場面は多々あると思う。} * 例 =|PERL| #!/usr/bin/perl use strict; use warnings; use Kwalify qw/validate/; my $shema = { type => 'map', mapping => { age => { …

https://seesaawiki.jp/w/perl5/d/Kwalify... - 2009年01月19日更新

Log::Dispatch::Colorful

&fukidashi(tomyhero){ログに色をつけれるよ} =|PERL| use Log::Dispatch::Colorful; my $screen = Log::Dispatch::Colorful->new( name => ’screen’, min_level => ’debug’, stderr => 1, forma…

https://seesaawiki.jp/w/perl5/d/Log%3a%3aDispatch%... - 2009年01月07日更新

Log::Dispatch::Configurator::YAML

&fukidashi(tomyhero){[[Log::Dispatch::Config]]の設定ファイルをYAML形式で書くことができます。} =|PERL| use Log::Dispatch::Config; use Log::Dispatch::Configurator::YAML; my $config = Log::Dispatch::Configurator::YAML->new('log.yml'); Log::Dispatch::Config->conf…

https://seesaawiki.jp/w/perl5/d/Log%3a%3aDispatch%... - 2009年01月05日更新

CPAN::Shell

fukidashi(tomyhero){cpan moduleのインストールとかのソースがかけるよ} =|PERL| use CPAN; # CPANに入ってます CPAN::Shell->install('Acme::Sex'); ||=…

https://seesaawiki.jp/w/perl5/d/CPAN%3a%3aShell... - 2009年01月05日更新

Devel::MemUsed

&fukidashi(tomyhero){newしてから増えたメモリサイズをしらべれるよ} =|PERL| #!/usr/bin/perl use warnings; use strict; use Devel::MemUsed; my $memused = Devel::MemUsed->new; eval "use CGI"; print sprintf( "CGI %08d bytes\n", $memused ); ||= &fukidashi(tomyhero){reset()…

https://seesaawiki.jp/w/perl5/d/Devel%3a%3aMemUsed... - 2009年01月05日更新

Module::Depends

wget http://search.cpan.org/CPAN/authors/id/T/TA/TARO/FormValidator-LazyWay-0.05.tar.gz tar xzvf FormValidator-LazyWay-0.05.tar.gz cd FormValidator-LazyWay-0.05 vim d.pl ||= =|PERL| #!/usr/bin/perl use warnings; use strict; use YAML; use Module::D…

https://seesaawiki.jp/w/perl5/d/Module%3a%3aDepend... - 2009年01月05日更新

URI::Template::Restrict

&fukidashi(tomyhero){urlに値をはめ込む型の仕様を実装する際にとても便利。デフォルト値のセットとかもできるよ。} =|PERL| #!/usr/bin/perl use warnings; use strict; use URI::Template::Restrict ; use Data::Dumper; my $template = URI::Template::Restrict->new( template => 'http://wiki.lived…

https://seesaawiki.jp/w/perl5/d/URI%3a%3aTemplate%... - 2009年01月04日更新

Hash::Merge

&fukidashi(tomyhero){ハッシュを上書きじゃなくて、マージしてくれるよ。型によってのマージの仕方を上書きできたりもします。} =|PERL| #!/usr/bin/perl use warnings; use strict; use Hash::Merge; use Data::Dumper; my $a = { a => 1, b => [1,2] , c => { a => 1 } }; my $b = { a => 2, b => [1,…

https://seesaawiki.jp/w/perl5/d/Hash%3a%3aMerge... - 2009年01月04日更新

Devel::REPL

&fukidashi(tomyhero){perlソースを書けるshellを立ち上げます。 プラグインを追加することにより、機能をふやすことができる作りになっているので色々試すとおもしろいかも。Mooseとか依存モジュールが多いのがちょっと難点かも。気になる人は、[[Devel::EvalContext]]を見てみるといいかな。} =|PERL| #!/usr/bin/perl use Devel::REPL; my $repl = Devel::REPL->new; $repl->l…

https://seesaawiki.jp/w/perl5/d/Devel%3a%3aREPL... - 2009年01月02日更新

File::ShareDir

fukidashi(tomyhero){cpanモジュールのper-dist and per-moduleのshareの位置、その中にあるファイルの存在の確認ができるよ。} * 基本例 =|PERL| #!/usr/bin/perl use warnings; use strict; use File::ShareDir ':ALL'; print dist_dir('File-ShareDir') . "\n"; print module_dir('File::ShareDir'). "\n";…

https://seesaawiki.jp/w/perl5/d/File%3a%3aShareDir... - 2009年01月01日更新

Devel::EvalContext

&fukidashi(tomyhero){コードを引数に渡して、evalで実行しちゃう感じです。} *例 =|PERL| #!/usr/bin/perl use warnings; use strict; use Devel::EvalContext; my $cxt = Devel::EvalContext->new(); my $hoge =$cxt->run(q{my $foo = "hoge";}); $cxt->run(q{print $foo;}); # hoge …

https://seesaawiki.jp/w/perl5/d/Devel%3a%3aEvalCon... - 2009年01月01日更新

Cache::Memcached::Managed

&fukidashi(tomyhero){グループでの消去とかできちゃうよ!} &fukidashi(tomyhero,right){key,namespace,version はデフォルトで指定されます。自分でコントロールしたい場合は各自指定しておかないと、同じデータが違うキーになるかもなので注意です。}…

https://seesaawiki.jp/w/perl5/d/Cache%3a%3aMemcach... - 2008年12月21日更新

どなたでも編集できます