1Test::HTTP::Server::SimUpsleer(3C)ontributed Perl DocumeTnetsatt:i:oHnTTP::Server::Simple(3)
2
3
4
6 Test::HTTP::Server::Simple - Test::More functions for
7 HTTP::Server::Simple
8
10 package My::WebServer;
11 use base qw/Test::HTTP::Server::Simple HTTP::Server::Simple/;
12
13 package main;
14 use Test::More tests => 42;
15
16 my $s = My::WebServer->new;
17
18 my $url_root = $s->started_ok("start up my web server);
19
20 # connect to "$url_root/cool/site" and test with Test::WWW::Mechanize,
21 # Test::HTML::Tidy, etc
22
24 This mixin class provides methods to test an HTTP::Server::Simple-based
25 web server. Currently, it provides only one such method: "started_ok".
26
27 started_ok [$text]
28 "started_ok" takes an optional test description. The server needs to
29 have been configured (specifically, its port needs to have been set),
30 but it should not have been run or backgrounded. "started_ok" calls
31 "background" on the server, which forks it to run in the background.
32 Test::HTTP::Server::Simple takes care of killing the server when your
33 test script dies, even if you kill your test script with an interrupt.
34 "started_ok" returns the URL "http://localhost:$port" which you can use
35 to connect to your server.
36
37 Note that if the child process dies, or never gets around to listening
38 for connections, this just hangs. (This may be fixed in a future
39 version.)
40
41 Also, it probably won't work if you use a custom Net::Server in your
42 server.
43
44 pids
45 Returns the PIDs of the processes which have been started. Since
46 multiple test servers can be running at one, be aware that this returns
47 a list.
48
50 Test::Builder, HTTP::Server::Simple, NEXT.
51
53 None reported.
54
56 Installs an interrupt signal handler, which may override any that
57 another part of your program has installed.
58
59 Please report any bugs or feature requests to
60 "bug-test-http-server-simple@rt.cpan.org", or through the web interface
61 at <http://rt.cpan.org>.
62
64 David Glasser "<glasser@bestpractical.com>"
65
67 Copyright (c) 2005, Best Practical Solutions, LLC. All rights
68 reserved.
69
70 This module is free software; you can redistribute it and/or modify it
71 under the same terms as Perl itself. See perlartistic.
72
74 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
75 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
76 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
77 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
78 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
79 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
80 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
81 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
82 NECESSARY SERVICING, REPAIR, OR CORRECTION.
83
84 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
85 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
86 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
87 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
88 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
89 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
90 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
91 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
92 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
93 DAMAGES.
94
95
96
97perl v5.28.1 2009-11-10 Test::HTTP::Server::Simple(3)