I have a test script that uses Plack::Create to benchmark my server application. A stripped down, runnable version looks like this:

#!/usr/bin/perl use Modern::Perl '2015'; use Plack::Test; use Plack::Builder; use HTTP::Request::Common; use Benchmark; my $real_app = sub { my $env = shift; $env->{user_id} = 1; return [200, ['Content-Type', 'text/plain'], ['ok']]; }; $Plack::Test::Impl = 'Server'; $ENV{PLACK_SERVER} = 'Starman'; my $test_starman = Plack::Test->create($real_app); my $count = $ARGV[0] // 10_000; my $block = $ARGV[1] // 1; for (0..$count) { my $response = $test_starman->request(POST "/test/ok", Content => +'' ); if ($response->code() == 200) { print "$_\r"; } else { print "\n$_\n"; last; } }

The real application is obviously more complex (it uses a DB, among others).

The problem with this is that Starman has a number of options, --max_requests and --workers being relevant here, that I can set from the command line (when starting as 'starman --workers' etc.), but not when starting it standalone like in the code above.

Is there a way to pass options to the server in the code above?


In reply to Starman options with Plack::Create by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.