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

📄 apache2::serverutil.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 3 页
字号:
.IP "ret: no return value" 4.IX Item "ret: no return value".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPThis function can be used to register a callback to be run once at theserver shutdown (compared to\&\f(CW\*(C`PerlChildExitHandler\*(C'\fRwhich will execute the callback for each exiting child process)..PPFor example in order to arrange the function \f(CW\*(C`do_my_cleanups()\*(C'\fR to berun every time the server shuts down (or restarts), run the followingcode at the server startup:.PP.Vb 1\&  Apache2::ServerUtil::server_shutdown_cleanup_register(\e&do_my_cleanups);.Ve.PPIt's necessary to run this code at the server startup (normally\&\fIstartup.pl\fR. The function will croak if run after the\&\f(CW\*(C`PerlPostConfigHandler\*(C'\fRphase..ie n .Sh """dir_config""".el .Sh "\f(CWdir_config\fP".IX Subsection "dir_config"\&\f(CW\*(C`$s\->dir_config()\*(C'\fR provides an interface for the per-servervariables specified by the \f(CW\*(C`PerlSetVar\*(C'\fR and \f(CW\*(C`PerlAddVar\*(C'\fR directives,and also can be manipulated via the\&\f(CW\*(C`APR::Table\*(C'\fR methods..PP.Vb 4\&  $table  = $s\->dir_config();\&  $value  = $s\->dir_config($key);\&  @values = $s\->dir_config($key);\&  $s\->dir_config($key, $val);.Ve.ie n .IP "obj: $s\fR ( \f(CW""Apache2::ServerRec object"" )" 4.el .IP "obj: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4.IX Item "obj: $s ( Apache2::ServerRec object )".PD 0.ie n .IP "opt arg2: $key ( string )" 4.el .IP "opt arg2: \f(CW$key\fR ( string )" 4.IX Item "opt arg2: $key ( string )".PDKey string.ie n .IP "opt arg3: $val ( string )" 4.el .IP "opt arg3: \f(CW$val\fR ( string )" 4.IX Item "opt arg3: $val ( string )"Value string.IP "ret: ..." 4.IX Item "ret: ..."Depends on the passed arguments, see further discussion.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPThe keys are case-insensitive..PP.Vb 1\&  $t = $s\->dir_config();.Ve.PP\&\fIdir_config()\fR called in a scalar context without the \f(CW$key\fR argumentreturns a \fI\s-1HASH\s0\fR reference blessed into the \fIAPR::Table\fR class. Thisobject can be manipulated via the \fIAPR::Table\fR methods. For availablemethods see \fIAPR::Table\fR..PP.Vb 1\&  @values = $s\->dir_config($key);.Ve.PPIf the \f(CW$key\fR argument is passed in the list context a list of allmatching values will be returned. This method is ineffective for bigtables, as it does a linear search of the table. Thefore avoid usingthis way of calling \fIdir_config()\fR unless you know that there could bemore than one value for the wanted key and all the values are wanted..PP.Vb 1\&  $value = $s\->dir_config($key);.Ve.PPIf the \f(CW$key\fR argument is passed in the scalar context only a singlevalue will be returned. Since the table preserves the insertion order,if there is more than one value for the same key, the oldest valueassosiated with the desired key is returned. Calling in the scalarcontext is also much faster, as it'll stop searching the table as soonas the first match happens..PP.Vb 1\&  $s\->dir_config($key => $val);.Ve.PPIf the \f(CW$key\fR and the \f(CW$val\fR arguments are used, the \fIset()\fR operationwill happen: all existing values associated with the key \f(CW$key\fR (andthe key itself) will be deleted and \f(CW$value\fR will be placed instead..PP.Vb 1\&  $s\->dir_config($key => undef);.Ve.PPIf \f(CW$val\fR is \fIundef\fR the \fIunset()\fR operation will happen: all existingvalues associated with the key \f(CW$key\fR (and the key itself) will bedeleted..ie n .Sh """exists_config_define""".el .Sh "\f(CWexists_config_define\fP".IX Subsection "exists_config_define"Check for a definition from the server startup command line(e.g. \f(CW\*(C`\-DMODPERL2\*(C'\fR).PP.Vb 1\&  $result = Apache2::ServerUtil::exists_config_define($name);.Ve.ie n .IP "arg1: $name ( string )" 4.el .IP "arg1: \f(CW$name\fR ( string )" 4.IX Item "arg1: $name ( string )"The define string to check for.ie n .IP "ret: $result ( boolean )" 4.el .IP "ret: \f(CW$result\fR ( boolean )" 4.IX Item "ret: $result ( boolean )"true if defined, false otherwise.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPFor example:.PP.Vb 2\&  print "this is mp2"\&      if Apache2::ServerUtil::exists_config_define(\*(AqMODPERL2\*(Aq);.Ve.ie n .Sh """get_handlers""".el .Sh "\f(CWget_handlers\fP".IX Subsection "get_handlers"Returns a reference to a list of handlers enabled fora given phase..PP.Vb 1\&  $handlers_list = $s\->get_handlers($hook_name);.Ve.ie n .IP "obj: $s\fR ( \f(CW""Apache2::ServerRec object"" )" 4.el .IP "obj: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4.IX Item "obj: $s ( Apache2::ServerRec object )".PD 0.ie n .IP "arg1: $hook_name ( string )" 4.el .IP "arg1: \f(CW$hook_name\fR ( string )" 4.IX Item "arg1: $hook_name ( string )".PDa string representing the phase to handle..ie n .IP "ret: $handlers_list (ref to an \s-1ARRAY\s0 of \s-1CODE\s0 refs)" 4.el .IP "ret: \f(CW$handlers_list\fR (ref to an \s-1ARRAY\s0 of \s-1CODE\s0 refs)" 4.IX Item "ret: $handlers_list (ref to an ARRAY of CODE refs)"a list of references to the handler subroutines.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee also:\&\f(CW\*(C`$r\->add_config\*(C'\fR.PPFor example:.PPA list of handlers configured to run at the \fIchild_exit\fR phase:.PP.Vb 1\&  @handlers = @{ $s\->get_handlers(\*(AqPerlChildExitHandler\*(Aq) || []};.Ve.ie n .Sh """get_server_built""".el .Sh "\f(CWget_server_built\fP".IX Subsection "get_server_built"Get the date and time that the server was built.PP.Vb 1\&  $when_built = Apache2::ServerUtil::get_server_built();.Ve.ie n .IP "ret: $when_built ( string )" 4.el .IP "ret: \f(CW$when_built\fR ( string )" 4.IX Item "ret: $when_built ( string )"The server build time string.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """get_server_version""".el .Sh "\f(CWget_server_version\fP".IX Subsection "get_server_version"Get the server version string.PP.Vb 1\&  $version = Apache2::ServerUtil::get_server_version();.Ve.ie n .IP "ret: $version ( string )" 4.el .IP "ret: \f(CW$version\fR ( string )" 4.IX Item "ret: $version ( string )"The server version string.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """is_perl_option_enabled""".el .Sh "\f(CWis_perl_option_enabled\fP".IX Subsection "is_perl_option_enabled"check whether a server level \f(CW\*(C`PerlOptions\*(C'\fR flag is enabled or not..PP.Vb 1\&  $result = $s\->is_perl_option_enabled($flag);.Ve.ie n .IP "obj: $s\fR ( \f(CW""Apache2::ServerRec object"" )" 4.el .IP "obj: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4.IX Item "obj: $s ( Apache2::ServerRec object )".PD 0.ie n .IP "arg1: $flag ( string )" 4.el .IP "arg1: \f(CW$flag\fR ( string )" 4.IX Item "arg1: $flag ( string )".ie n .IP "ret: $result ( boolean )" 4.el .IP "ret: \f(CW$result\fR ( boolean )" 4.IX Item "ret: $result ( boolean )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPFor example to check whether the \f(CW\*(C`ChildExit\*(C'\fR hook is enabled (whichcan be disabled with \f(CW\*(C`PerlOptions \-ChildExit\*(C'\fR) and configure somehandlers to run if enabled:.PP.Vb 2\&  $s\->push_handlers(ChildExit => \e&child_exit)\&      if $s\->is_perl_option_enabled(\*(AqChildExit\*(Aq);.Ve.PPSee also:PerlOptions andthe equivalent function for directory level PerlOptionsflags..ie n .Sh """method_register""".el .Sh "\f(CWmethod_register\fP".IX Subsection "method_register"Register a new request method, and return the offset that will beassociated with that method..PP.Vb 1\&  $offset = $s\->method_register($methname);.Ve.ie n .IP "obj: $s\fR ( \f(CW""Apache2::ServerRec object"" )" 4.el .IP "obj: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4.IX Item "obj: $s ( Apache2::ServerRec object )".PD 0.ie n .IP "arg1: $methname ( string )" 4.el .IP "arg1: \f(CW$methname\fR ( string )" 4.IX Item "arg1: $methname ( string )".PDThe name of the new method to register (in addition to the alreadysupported \f(CW\*(C`GET\*(C'\fR, \f(CW\*(C`HEAD\*(C'\fR, etc.).ie n .IP "ret: $offset ( integer )" 4.el .IP "ret: \f(CW$offset\fR ( integer )" 4.IX Item "ret: $offset ( integer )"An int value representing an offset into a bitmask. You can probablyignore it..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPThis method allows you to extend the \s-1HTTP\s0 protocol to support newmethods, which fit the \s-1HTTP\s0 paradigm.  Of course you will need towrite a client that understands that protocol extension.  For a goodexample, refer to the \f(CW\*(C`MyApache2::SendEmail\*(C'\fR example presented in\&\f(CW\*(C`the PerlHeaderParserHandlersection\*(C'\fR,which demonstrates how a new method \f(CW\*(C`EMAIL\*(C'\fR is registered and used..ie n .Sh """push_handlers""".el .Sh "\f(CWpush_handlers\fP".IX Subsection "push_handlers"Add one or more handlers to a list of handlers to be called for agiven phase..PP.Vb 2\&  $ok = $s\->push_handlers($hook_name => \e&handler);\&  $ok = $s\->push_handlers($hook_name => [\e&handler, \e&handler2]);.Ve.ie n .IP "obj: $s\fR ( \f(CW""Apache2::ServerRec object"" )" 4.el .IP "obj: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4.IX Item "obj: $s ( Apache2::ServerRec object )".PD 0.ie n .IP "arg1: $hook_name ( string )" 4.el .IP "arg1: \f(CW$hook_name\fR ( string )" 4.IX Item "arg1: $hook_name ( string )".PDthe phase to add the handlers to.ie n .IP "arg2: $handlers ( \s-1CODE\s0 ref or \s-1SUB\s0 name or an \s-1ARRAY\s0 ref )" 4.el .IP "arg2: \f(CW$handlers\fR ( \s-1CODE\s0 ref or \s-1SUB\s0 name or an \s-1ARRAY\s0 ref )" 4.IX Item "arg2: $handlers ( CODE ref or SUB name or an ARRAY ref )"a single handler \s-1CODE\s0 reference or just a name of the subroutine(fully qualified unless defined in the current package)..Spif more than one passed, use a reference to an array of \s-1CODE\s0 refsand/or subroutine names..ie n .IP "ret: $ok ( boolean )" 4.el .IP "ret: \f(CW$ok\fR ( boolean )" 4.IX Item "ret: $ok ( boolean )"returns a true value on success, otherwise a false value.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee also:\&\f(CW\*(C`$r\->add_config\*(C'\fR.PPExamples:.PPA single handler:.PP.Vb 1\&  $s\->push_handlers(PerlChildExitHandler => \e&handler);.Ve.PPMultiple handlers:.PP.Vb 1\&  $s\->push_handlers(PerlChildExitHandler => [\*(AqFoo::Bar::handler\*(Aq, \e&handler2]);.Ve.PPAnonymous functions:.PP.Vb 1\&  $s\->push_handlers(PerlLogHandler => sub { return Apache2::Const::OK });.Ve.ie n .Sh """restart_count""".el .Sh "\f(CWrestart_count\fP"

⌨️ 快捷键说明

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