⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apache::test.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.Sprequires Apache 2.0.40 or higher..IP "need_apache_version" 4.IX Item "need_apache_version"Used to require a specific version of Apache..SpFor example:.Sp.Vb 1\&  plan tests => 5, need_apache_version("2.0.40");.Ve.Sprequires Apache 2.0.40..IP "need_apache_mpm" 4.IX Item "need_apache_mpm"Used to require a specific Apache Multi-Processing Module..SpFor example:.Sp.Vb 1\&  plan tests => 5, need_apache_mpm(\*(Aqprefork\*(Aq);.Ve.Sprequires the prefork \s-1MPM\s0..IP "need_perl" 4.IX Item "need_perl".Vb 2\&  plan tests => 5, need_perl \*(Aqiolayers\*(Aq;\&  plan tests => 5, need_perl \*(Aqithreads\*(Aq;.Ve.SpRequires a perl extension to be present, or perl compiled with certaincapabilities..SpThe first example tests whether \f(CW\*(C`PerlIO\*(C'\fR is available, the secondwhether:.Sp.Vb 1\&  $Config{useithread} eq \*(Aqdefine\*(Aq;.Ve.IP "need_min_perl_version" 4.IX Item "need_min_perl_version"Used to require a minimum version of Perl..SpFor example:.Sp.Vb 1\&  plan tests => 5, need_min_perl_version("5.008001");.Ve.Sprequires Perl 5.8.1 or higher..IP "need_module" 4.IX Item "need_module".Vb 3\&  plan tests => 5, need_module \*(AqCGI\*(Aq;\&  plan tests => 5, need_module qw(CGI Find::File);\&  plan tests => 5, need_module [\*(AqCGI\*(Aq, \*(AqFind::File\*(Aq, \*(Aqcgid\*(Aq];.Ve.SpRequires Apache C and Perl modules. The function accept a list ofarguments or a reference to a list..SpIn case of C modules, depending on how the module name was passed itmay pass through the following completions:.RS 4.IP "1 need_module 'proxy_http.c'" 4.IX Item "1 need_module 'proxy_http.c'"If there is the \fI.c\fR extension, the module name will be looked up asis, i.e. \fI'proxy_http.c'\fR..IP "2 need_module 'mod_cgi'" 4.IX Item "2 need_module 'mod_cgi'"The \fI.c\fR extension will be appended before the lookup, turning it into\&\fI'mod_cgi.c'\fR..IP "3 need_module 'cgi'" 4.IX Item "3 need_module 'cgi'"The \fI.c\fR extension and \fImod_\fR prefix will be added before thelookup, turning it into \fI'mod_cgi.c'\fR..RE.RS 4.RE.IP "need_min_module_version" 4.IX Item "need_min_module_version"Used to require a minimum version of a module.SpFor example:.Sp.Vb 1\&  plan tests => 5, need_min_module_version(CGI => 2.81);.Ve.Sprequires \f(CW\*(C`CGI.pm\*(C'\fR version 2.81 or higher..SpCurrently works only for perl modules..IP "need" 4.IX Item "need".Vb 8\&  plan tests => 5,\&      need \*(AqLWP\*(Aq,\&           { "perl >= 5.8.0 and w/ithreads is required" => \&             ($Config{useperlio} && $] >= 5.008) },\&           { "not Win32"                 => sub { $^O eq \*(AqMSWin32\*(Aq },\&             "foo is disabled"           => \e&is_foo_enabled,\&           },\&           \*(Aqcgid\*(Aq;.Ve.Sp\&\fIneed()\fR is more generic function which can impose multiple requirementsat once. All requirements must be satisfied..Sp\&\fIneed()\fR's argument is a list of things to test. The list can includescalars, which are passed to \fIneed_module()\fR, and hash references. Ifhash references are used, the keys, are strings, containing a reasonfor a failure to satisfy this particular entry, the values are thecondition, which are satisfaction if they return true. If the value is0 or 1, it used to decide whether the requirements very satisfied, soyou can mix special \f(CW\*(C`need_*()\*(C'\fR functions that return 0 or 1. Forexample:.Sp.Vb 2\&  plan tests => 1, need \*(AqCompress::Zlib\*(Aq, \*(Aqdeflate\*(Aq,\&      need_min_apache_version("2.0.49");.Ve.SpIf the scalar value is a string, different from 0 or 1, it's passed to\&\fI\fIneed_module()\fI\fR.  If the value is a code reference, it gets executedat the time of check and its return value is used to check thecondition. If the condition check fails, the provided (in a key)reason is used to tell user why the test was skipped..SpIn the presented example, we require the presence of the \f(CW\*(C`LWP\*(C'\fR Perlmodule, \f(CW\*(C`mod_cgid\*(C'\fR, that we run under perl >= 5.7.3 on Win32..SpIt's possible to put more than one requirement into a single hashreference, but be careful that the keys will be different..SpIt's also important to mention to avoid using:.Sp.Vb 1\&  plan tests => 1, requirement1 && requirement2;.Ve.Sptechnique. While test-wise that technique is equivalent to:.Sp.Vb 1\&  plan tests => 1, need requirement1, requirement2;.Ve.Spsince the test will be skipped, unless all the rules are satisfied,it's not equivalent for the end users. The second technique, deploying\&\f(CW\*(C`need()\*(C'\fR and a list of requirements, always runs all the requirementchecks and reports all the missing requirements. In the case of thefirst technique, if the first requirement fails, the second is notrun, and the missing requirement is not reported. So let's say all therequirements are missing Apache modules, and a user wants to satisfyall of these and run the test suite again. If all the unsatisfiedrequirements are reported at once, she will need to rebuild Apacheonce. If only one requirement is reported at a time, she will have torebuild Apache as many times as there are elements in the \f(CW\*(C`&&\*(C'\fRstatement..SpAlso see \fIplan()\fR..IP "under_construction" 4.IX Item "under_construction".Vb 1\&  plan tests => 5, under_construction;.Ve.Spskip all tests, noting that the tests are under construction.IP "skip_reason" 4.IX Item "skip_reason".Vb 1\&  plan tests => 5, skip_reason(\*(Aqmy custom reason\*(Aq);.Ve.Spskip all tests.  the reason you specify will be given at runtime.if no reason is given a default reason will be used..SH "Additional Configuration Variables".IX Header "Additional Configuration Variables".IP "basic_config" 4.IX Item "basic_config".Vb 2\&  my $basic_cfg = Apache::Test::basic_config();\&  $basic_cfg\->write_perlscript($file, $content);.Ve.Sp\&\f(CW\*(C`basic_config()\*(C'\fR is similar to \f(CW\*(C`config()\*(C'\fR, but doesn't contain anyhttpd-specific information and should be used for operations thatdon't require any httpd-specific knowledge..IP "config" 4.IX Item "config".Vb 3\&  my $cfg = Apache::Test::config();\&  my $server_rev = $cfg\->{server}\->{rev};\&  ....Ve.Sp\&\f(CW\*(C`config()\*(C'\fR gives an access to the configuration object..IP "vars" 4.IX Item "vars".Vb 3\&  my $serverroot = Apache::Test::vars\->{serverroot};\&  my $serverroot = Apache::Test::vars(\*(Aqserverroot\*(Aq);\&  my($top_dir, $t_dir) = Apache::Test::vars(qw(top_dir t_dir));.Ve.Sp\&\f(CW\*(C`vars()\*(C'\fR gives an access to the configuration variables, otherwiseaccessible as:.Sp.Vb 1\&  $vars = Apache::Test::config()\->{vars};.Ve.SpIf no arguments are passed, the reference to the variables hash isreturned. If one or more arguments are passed the corresponding valuesare returned..SH "Test::More Integration".IX Header "Test::More Integration"There are a few caveats if you want to use \fIApache::Test\fR with \&\fITest::More\fR instead of the default \fITest\fR backend.  The first isthat \fITest::More\fR requires you to use its own \f(CW\*(C`plan()\*(C'\fR functionand not the one that ships with \fIApache::Test\fR.  \fITest::More\fR alsodefines \f(CW\*(C`ok()\*(C'\fR and \f(CW\*(C`skip()\*(C'\fR functions that are different, and simply \f(CW\*(C`use\*(C'\fRing both modules in your test script will lead to redefinedwarnings for these subroutines..PPTo assist \fITest::More\fR users we have created a special \fIApache::Test\fRimport tag, \f(CW\*(C`:withtestmore\*(C'\fR, which will export all of the standard\&\fIApache::Test\fR symbols into your namespace except the ones that collidewith \fITest::More\fR..PP.Vb 2\&    use Apache::Test qw(:withtestmore);\&    use Test::More;\&\&    plan tests => 1;           # Test::More::plan()\&\&    ok (\*(Aqyes\*(Aq, \*(Aqtesting ok\*(Aq);  # Test::More::ok().Ve.PPNow, while this works fine for standard client-side tests (such as \f(CW\*(C`t/basic.t\*(C'\fR), the more advanced features of \fIApache::Test\fRrequire using \fITest::More\fR as the sole driver behind the scenes..PPShould you choose to use \fITest::More\fR as the backend forserver-based tests (such as \f(CW\*(C`t/response/TestMe/basic.pm\*(C'\fR) you willneed to use the \f(CW\*(C`\-withtestmore\*(C'\fR action tag:.PP.Vb 1\&    use Apache::Test qw(\-withtestmore);\&\&    sub handler {\&\&        my $r = shift;\&\&        plan $r, tests => 1;           # Test::More::plan() with\&                                       # Apache::Test features\&\&        ok (\*(Aqyes\*(Aq, \*(Aqtesting ok\*(Aq);      # Test::More::ok()\&    }.Ve.PP\&\f(CW\*(C`\-withtestmore\*(C'\fR tells \fIApache::Test\fR to use \fITest::More\fRinstead of \fITest.pm\fR behind the scenes.  Note that you are notrequired to \f(CW\*(C`use Test::More\*(C'\fR yourself with the \f(CW\*(C`\-withtestmore\*(C'\fRoption and that the \f(CW\*(C`use Test::More tests => 1\*(C'\fR syntaxmay have unexpected results..PPNote that \fITest::More\fR version 0.49, available within the\&\fITest::Simple\fR 0.49 distribution on \s-1CPAN\s0, or greater is requiredto use this feature..PPBecause \fIApache:Test\fR was initially developed using \fITest\fR asthe framework driver, complete \fITest::More\fR integration isconsidered experimental at this time \- it is supported as best aspossible but is not guaranteed to be as stable as the default \fITest\fRinterface at this time..SH "Apache::TestToString Class".IX Header "Apache::TestToString Class"The \fIApache::TestToString\fR class is used to capture \fITest.pm\fR outputinto a string.  Example:.PP.Vb 1\&    Apache::TestToString\->start;\&\&    plan tests => 4;\&\&    ok $data eq \*(Aqfoo\*(Aq;\&\&    ...\&\&    # $tests will contain the Test.pm output: 1..4\enok 1\en...\&    my $tests = Apache::TestToString\->finish;.Ve.SH "SEE ALSO".IX Header "SEE ALSO"The Apache-Test tutorial:<http://perl.apache.org/docs/general/testing/testing.html>..PPApache::TestRequest subclasses LWP::UserAgent andexports a number of useful functions for sending request to the Apache testserver. You can then test the results of those requests..PPUse Apache::TestMM in your \fIMakefile.PL\fR to set up yourdistribution for testing..SH "AUTHOR".IX Header "AUTHOR"Doug MacEachern with contributions from Geoffrey Young, PhilippeM. Chiasson, Stas Bekman and others..PPQuestions can be asked at the test-dev <at> httpd.apache.org listFor more information see: http://httpd.apache.org/test/..SH "POD ERRORS".IX Header "POD ERRORS"Hey! \fBThe above document had some coding errors, which are explained below:\fR.IP "Around line 889:" 4.IX Item "Around line 889:"\&'=item' outside of any '=over'.IP "Around line 921:" 4.IX Item "Around line 921:"You forgot a '=back' before '=head1'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -