Catalyst-Runtime

 view release on metacpan or  search on metacpan

lib/Catalyst.pm  view on Meta::CPAN

    my $class = shift;
    if(my $data_handlers = $class->_data_handlers) {
        return %$data_handlers;
    } else {
        $class->setup_data_handlers;
        return $class->registered_data_handlers;
    }
}

sub setup_data_handlers {
    my ($class, %data_handler_callbacks) = @_;
    %data_handler_callbacks = (
      %{$class->default_data_handlers},
      %{$class->config->{'data_handlers'}||+{}},
      %data_handler_callbacks);

    $class->_data_handlers(\%data_handler_callbacks);
}

sub default_data_handlers {
    my ($class) = @_;
    return +{
      'application/x-www-form-urlencoded' => sub {
          my ($fh, $req) = @_;
          my $params = $req->_use_hash_multivalue ? $req->body_parameters->mixed : $req->body_parameters;
          Class::Load::load_first_existing_class('CGI::Struct::XS', 'CGI::Struct')
            ->can('build_cgi_struct')->($params);

t/body_fh.t  view on Meta::CPAN


    my @expected = (qw/Hello manual_write/);
    return Plack::Util::inline_object(
        close => sub { ok 1, 'closed'; is scalar(@expected), 0; },
        write => sub { is shift, shift(@expected) },
      );
  });
}

## We need to specify the number of expected tests because tests that live
## in the callbacks might never get run (thus all ran tests pass but not all
## required tests run).

done_testing(28);

t/http_exceptions.t  view on Meta::CPAN

    my $cb = shift;
    my $res = $cb->(GET "/root/just_die");
    is $res->code, 500;
    like $res->content, qr'not dead yet', 'not dead yet';
    like $res->content, qr'HTTPExceptions', 'HTTPExceptions';
};



# We need to specify the number of expected tests because tests that live
# in the callbacks might never get run (thus all ran tests pass but not all
# required tests run).

done_testing(17);

t/http_exceptions_backcompat.t  view on Meta::CPAN

};

test_psgi $psgi, sub {
    my $cb = shift;
    my $res = $cb->(GET "/root/just_die");
    is $res->code, 500;
    like $res->content, qr'not dead yet', 'not dead yet';
};

# We need to specify the number of expected tests because tests that live
# in the callbacks might never get run (thus all ran tests pass but not all
# required tests run).

done_testing(12);



( run in 0.959 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )