こちらの問題。http://d.hatena.ne.jp/gfx/20081007/1223340787回答がすでにいろいろ出てるけど。 これで。 #!/usr/bin/perl use strict; use Test::More 'no_plan'; sub f{ my $builder = Test::More->builder; my $out = $builder->output; print $out not ok... 続きを読む
PerlPerl Quiz - package名について - gfxの日記 #!perl -w use strict; use Test::More 'no_plan'; sub f{ # 何かする bless({}, '::Foo'); } f(); is ref(bless({}, 'Foo')), 'Foo'; __END__ うわあ,適当にそれっぽく書いてみたら失敗したよこれ.いみふ! 続きを読む
PerlPerl Quiz - package名について - gfxの日記 #!perl -w use strict; use Test::More 'no_plan'; sub f{ package main::Foo; } f(); is ref(bless({}, 'Foo')), 'Foo'; とか #!perl -w use strict; use Test::More 'no_plan'; sub f{ package Foo; our @ISA ... 続きを読む
http://d.hatena.ne.jp/gfx/20081007/1223340787 こう? #!perl -w use strict; use Test::More 'no_plan'; sub f{ # 何かする package ::Foo; } f(); is ref(bless({}, 'Foo')), 'Foo'; __END__ 続きを読む
Perl Quiz - package名について - gfxの日記 テストモジュールを否定してみました. use strict; use Test::More 'no_plan'; sub f{ local $SIG{__WARN__} = sub { ; }; # おまじない local $SIG{__DIE__} = sub { ; }; # おまじない *is = sub { ; };... 続きを読む
http://d.hatena.ne.jp/gfx/20081007/1223340787 #!perl -w use strict; use Test::More 'no_plan'; sub f{ # 何かする no strict; BEGIN { *CORE::GLOBAL::ref = sub { "__ANON__" } } } f(); is ref(bless({}, 'Foo')), 'Foo'; __END__ こうですね。わかりま... 続きを読む
Perl Quiz - package名について - gfxの日記 まあこういうことではないよねとおもいつつ。 #!perl -w use strict; use Test::More 'no_plan'; sub f{ *is = \&isnt; } f(); is ref(bless({}, 'Foo')), 'Foo'; 続きを読む
Perl Quiz - package名について - gfxの日記Q.以下のテストケースが失敗するようなf()を書いてください。ただし,ライブラリを使用してはいけません。回答は一週間後くらいに。 #!perl -w use strict; use Test::More 'no_plan'; sub f{ # 何かする { package F... 続きを読む