apr::uri.3
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· 3 代码 · 共 688 行 · 第 1/2 页
3
688 行
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings. \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote. \*(C+ will.\" give a nicer C++. Capital omega is used to do unbreakable dashes and.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\. ds -- \(*W-. ds PI pi. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch. ds L" "". ds R" "". ds C` "". ds C' ""'br\}.el\{\. ds -- \|\(em\|. ds PI \(*p. ds L" ``. ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD. Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff.if n \{\. ds #H 0. ds #V .8m. ds #F .3m. ds #[ \f1. ds #] \fP.\}.if t \{\. ds #H ((1u-(\\\\n(.fu%2u))*.13m). ds #V .6m. ds #F 0. ds #[ \&. ds #] \&.\}. \" simple accents for nroff and troff.if n \{\. ds ' \&. ds ` \&. ds ^ \&. ds , \&. ds ~ ~. ds /.\}.if t \{\. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u". ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}. \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E. \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'. \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\. ds : e. ds 8 ss. ds o a. ds d- d\h'-1'\(ga. ds D- D\h'-1'\(hy. ds th \o'bp'. ds Th \o'LP'. ds ae ae. ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "mod_perl-2.0.2::docs::api::APR::URI 3".TH mod_perl-2.0.2::docs::api::APR::URI 3 "2005-10-21" "perl v5.10.0" "User Contributed Perl Documentation".\" For nroff, turn off justification. Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"APR::URI \- Perl API for URI manipulations.SH "Synopsis".IX Header "Synopsis".Vb 1\& use APR::URI ();\& \& my $url = \*(Aqhttp://user:pass@example.com:80/foo?bar#item5\*(Aq;\& \& # parse and break the url into components\& my $parsed = APR::URI\->parse($r\->pool, $url);\& print $parsed\->scheme;\& print $parsed\->user;\& print $parsed\->password;\& print $parsed\->hostname;\& print $parsed\->port;\& print $parsed\->path;\& print $parsed\->rpath;\& print $parsed\->query;\& print $parsed\->fragment;\& \& # reconstruct the url, after changing some components and completely\& # removing other\& $parsed\->scheme($new_scheme);\& $parsed\->user(undef);\& $parsed\->password(undef);\& $parsed\->hostname($new_hostname);\& $parsed\->port($new_port);\& $parsed\->path($new_path);\& $parsed\->query(undef);\& $parsed\->fragment(undef);\& print $parsed\->unparse;\& \& # get the password field too (by default it\*(Aqs not revealed)\& use APR::Const \-compile => qw(URI_UNP_REVEALPASSWORD);\& print $parsed\->unparse(APR::Const::URI_UNP_REVEALPASSWORD);\& \& # what the default port for the ftp protocol?\& my $ftp_port = APR::URI::port_of_scheme("ftp");.Ve.SH "Description".IX Header "Description"\&\f(CW\*(C`APR::URI\*(C'\fR allows you to parse \s-1URI\s0 strings, manipulate each of the\&\s-1URI\s0 elements and deparse them back into URIs..PPAll \f(CW\*(C`APR::URI\*(C'\fR object accessors accept a string or an \f(CW\*(C`undef\*(C'\fR valueas an argument. Same goes for return value. It's important todistinguish between an empty string and \f(CW\*(C`undef\*(C'\fR. For example let'ssay your code was:.PP.Vb 2\& my $uri = \*(Aqhttp://example.com/foo?bar#item5\*(Aq;\& my $parsed = APR::URI\->parse($r\->pool, $uri);.Ve.PPNow you no longer want to the query and fragment components in thefinal url. If you do:.PP.Vb 2\& $parsed\->fragment(\*(Aq\*(Aq);\& $parsed\->query(\*(Aq\*(Aq);.Ve.PPfollowed by:.PP.Vb 1\& my $new_uri = parsed\->unparse;.Ve.PPthe resulting \s-1URI\s0 will be:.PP.Vb 1\& http://example.com/foo?#.Ve.PPwhich is probably not something that you've expected. In order to getrid of the separators, you must completely unset the fields you don'twant to see. So, if you do:.PP.Vb 2\& $parsed\->fragment(undef);\& $parsed\->query(undef);.Ve.PPfollowed by:.PP.Vb 1\& my $new_uri = parsed\->unparse;.Ve.PPthe resulting \s-1URI\s0 will be:.PP.Vb 1\& http://example.com/foo.Ve.PPAs mentioned earlier the same goes for return values, so continuingthis example:.PP.Vb 2\& my $new_fragment = $parsed\->fragment();\& my $new_query = $parsed\->query();.Ve.PPBoth values now contain \f(CW\*(C`undef\*(C'\fR, therefore you must be careful whenusing the return values, when you use them, as you may get warnings..PPAlso make sure you read through \f(CW\*(C`the unparse()section\*(C'\fR as various optional flags affect how thedeparsed \s-1URI\s0 is rendered..SH "API".IX Header "API"\&\f(CW\*(C`APR::URI\*(C'\fR provides the following functions and/or methods:.ie n .Sh """fragment""".el .Sh "\f(CWfragment\fP".IX Subsection "fragment"Get/set trailing \*(L"#fragment\*(R" string.PP.Vb 1\& $oldval = $parsed\->fragment($newval);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( string or undef )" 4.IX Item "opt arg1: $newval ( string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """hostinfo""".el .Sh "\f(CWhostinfo\fP".IX Subsection "hostinfo"Get/set combined \f(CW\*(C`[user[:password]@]host[:port]\*(C'\fR.PP.Vb 1\& $oldval = $parsed\->hostinfo($newval);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( string or undef )" 4.IX Item "opt arg1: $newval ( string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPThe \f(CW\*(C`hostinfo\*(C'\fR value is set automatically when\&\f(CW\*(C`parse()\*(C'\fR is called..PPIt's not updated if any of the individual fields is modified..PPIt's not used when \f(CW\*(C`unparse()\*(C'\fR is called..ie n .Sh """hostname""".el .Sh "\f(CWhostname\fP".IX Subsection "hostname"Get/set hostname.PP.Vb 1\& $oldval = $parsed\->hostname($newval);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( string or undef )" 4.IX Item "opt arg1: $newval ( string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """password""".el .Sh "\f(CWpassword\fP".IX Subsection "password"Get/set password (as in http://user:password@host:port/).PP.Vb 1\& $oldval = $parsed\->password($newval);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( string or undef )" 4.IX Item "opt arg1: $newval ( string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """parse"""
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?