I need to build a server-side application (tiny web service) for testing proposes. What are some CPAN modules and Perl libraries for implementing such task?
Testing a tiny Web service with Plack::Test:
use Plack::Test;
use Test::More;
test_psgi(
    app => sub {
        my ($env) = @_;
        return [200, ['Content-Type' => 'text/plain'], ["Hello World"]],
    },
    client => sub {
        my ($cb) = @_;
        my $req  = HTTP::Request->new(GET => "http://localhost/hello");
        my $res  = $cb->($req);
        like $res->content, qr/Hello World/;
    },
);
done_testing;
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With