'request_send' => sub { my $ua = ua; my $res = $ua->get('http://www.example.com'); ok($res->is_success, 'handler should succeed'); is($res->content,'ok','handler-provided response should be used'); }; subtest 'request_prepare' => sub { my $ua = ua; $ua->add_handler( request_prepare => sub { # the docs say this is the way to replace the request $_[0] = HTTP::Request->new(POST=>'http://mmm.example.com/'); (固有名詞などはマスク)
Auth::SASL.new; ok $sasl, 'got an object'; isa-ok $sasl, Auth::SASL; ok $sasl.supports-client-mechanisms('PLAIN'), 'supports PLAIN'; ok $sasl.supports-client-mechanisms('ANONYMOUS'), 'supports ANONYMOUS'; ok $sasl.supports-client-mechanisms('PLAIN ANONYMOUS'), 'supports PLAIN ANONYMOUS'; ok $sasl.supports-client-mechanisms('PLAIN WEIRD'), 'supports PLAIN WEIRD'; nok $sasl.supports-client-mechanisms('SUPER WEIRD'), 'does not supoprt SUPER WEIRD'; (固有名詞などはマスク)
Digest::SHA1; use Digest::SHA2; # tests taken from wikipedia is hmac-hex("", "", &md5), '74e6f7298a9c2d168935f58c001bad88', "Empty md5 HMAC"; is hmac-hex("", "", &sha1), 'fbdb1d1b18aa6c08324b7d64b71fb76370690e1d', "Empty SHA1 HMAC"; is hmac-hex("", "", &sha256), 'b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad', "Empty SHA256 HMAC";
candidates. # # Strategies are called in turn until a single Language is re STRATEGIES = [ Linguist::Strategy::Modeline, Linguist::Strategy::Filename, Linguist::Shebang, Linguist::Strategy::Extension, Linguist::Strategy::XML, Linguist::Strategy::Manpage, Linguist::Heuristics, Linguist::Classifier ] … cpanfile は Perl、.irbrc は Ruby など
candidates = Linguist.instrument("linguist.strategy", :blob => blob, :str strategy.call(blob, languages) end if candidates.size == 1 languages = candidates break elsif candidates.size > 1 # More than one candidate was found, pass them to the next strategy. languages = candidates else # No candidates, try the next strategy end end