📄 ch20_05.htm
字号:
<a name="INDEX-2642" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>base</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->base([<em class="replaceable">base</em>])</pre><p><a name="INDEX-2642" />Gets or sets the base URL associatedwith the URL in this URI::URL object. The base URL is useful forconverting a relative URL into an absolute URL.</p></div><a name="INDEX-2643" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>crack</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->crack( )</pre><p><a name="INDEX-2643" />Returns an array with the followingdata: (<tt class="literal">scheme</tt>, <tt class="literal">user</tt>,<tt class="literal">password</tt>, <tt class="literal">host</tt>,<tt class="literal">port</tt>, <tt class="literal">epath</tt>,<tt class="literal">eparams</tt>, <tt class="literal">equery</tt>,<tt class="literal">frag</tt>).</p></div><a name="INDEX-2644" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>default_port</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->default_port([<em class="replaceable">port</em>])</pre><p><a name="INDEX-2644" />When invoked with no parameters,this method returns the default port for the URL defined in theobject. The default port is based on the scheme used. Even if theport for the URL is explicitly changed by the user with the<tt class="literal">port</tt> method, the default port is always the same.</p></div><a name="INDEX-2645" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>eparams</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->eparams([<em class="replaceable">param</em>])</pre><p><a name="INDEX-2645" />When invoked with no arguments,this method returns the escaped parameter of the URL defined in theobject. When invoked with an argument, the object'sescaped parameter is assigned to that value.</p></div><a name="INDEX-2646" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>epath</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->epath( )</pre><p><a name="INDEX-2646" />When invoked with no parameters,this method returns the escaped path of the URL defined in theobject. When invoked with a parameter, the object'sescaped path is assigned to that value.</p></div><a name="INDEX-2647" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>eq</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->eq(<em class="replaceable">other_url</em>)</pre><p><a name="INDEX-2647" />Returns true when theobject's URL is equal to the URL specified.</p></div><a name="INDEX-2648" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>equery</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->equery([<em class="replaceable">string</em>])</pre><p><a name="INDEX-2648" />When invoked with no arguments,this method returns the escaped query string of the URL defined inthe object. When invoked with an argument, theobject's escaped query string is assigned to thatvalue.</p></div><a name="INDEX-2649" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>frag</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->frag([<em class="replaceable">frag</em>])</pre><p><a name="INDEX-2649" />When invoked with no arguments,this method returns the fragment of the URL defined in the object.When invoked with an argument, the object's fragmentis assigned to that value.</p></div><a name="INDEX-2650" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>full_path</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->full_path( )</pre><p><a name="INDEX-2650" />Returns a string consisting of theescaped path, escaped parameters, and escaped query string.</p></div><a name="INDEX-2651" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>host</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->host([<em class="replaceable">hostname</em>])</pre><p><a name="INDEX-2651" />When invoked with no parameters, thismethod returns the hostname in the URL defined in the object. Wheninvoked with a parameter, the object's hostname isassigned to that value.</p></div><a name="INDEX-2652" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>netloc</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->netloc([<em class="replaceable">netloc</em>])</pre><p><a name="INDEX-2652" />When invoked with no parameters,this method returns the network location for the URL defined in theobject. The network location is a string composed of"user:password@host:port", in whichthe user, password, and port may be omitted when not defined. When<tt class="literal">netloc</tt> is invoked with a parameter, theobject's network location is defined to that value.Changes to the network location are reflected in the<tt class="literal">user</tt>, <tt class="literal">password</tt>,<tt class="literal">host</tt>, and <tt class="literal">port</tt> methods.</p></div><a name="INDEX-2653" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>params</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->params([<em class="replaceable">param</em>])</pre><p><a name="INDEX-2653" />Same as <tt class="literal">eparams</tt>,except that the parameter that is set/returned is not escaped.</p></div><a name="INDEX-2654" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>password</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->password([<em class="replaceable">passwd</em>])</pre><p><a name="INDEX-2654" />When invoked with no parameters, thismethod returns the password in the URL defined in the object. Wheninvoked with a parameter, the object's password isassigned to that value.</p></div><a name="INDEX-2655" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>path</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->path([<em class="replaceable">pathname</em>])</pre><p><a name="INDEX-2655" />Same as <tt class="literal">epath</tt>,except that the path that is set/returned is not escaped.</p></div><a name="INDEX-2656" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>port</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->port([<em class="replaceable">port</em>])</pre><p><a name="INDEX-2656" />When invoked with no parameters, thismethod returns the port for the URL defined in the object. If a portwasn't explicitly defined in the URL, a default portis assumed. When invoked with a parameter, theobject's port is assigned to that value.</p></div><a name="INDEX-2657" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>query</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->query([<em class="replaceable">param</em>])</pre><p><a name="INDEX-2657" />Same as <tt class="literal">equery</tt>,except that the parameter that is set/returned is not escaped.</p></div><a name="INDEX-2658" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>rel</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->rel(<em class="replaceable">base</em>)</pre><p><a name="INDEX-2658" />Given a base as a first parameteror a previous definition of the base, returns the currentobject's URL relative to the base URL.</p></div><a name="INDEX-2659" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>scheme</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->scheme([<em class="replaceable">scheme</em>])</pre><p><a name="INDEX-2659" />When invoked with no parameters,this method returns the scheme in the URL defined in the object. Wheninvoked with a parameter, the object's scheme isassigned to that value.</p></div><a name="INDEX-2660" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>strict</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>URI::URL::strict(<em class="replaceable">bool</em>)</pre><p><a name="INDEX-2660" />When set, the URI::URL module calls<tt class="literal">croak</tt> upon encountering an error. When disabled,the URI::URL module may behave more gracefully. The function returnsthe previous value of <tt class="literal">strict</tt>. This function is notexported explicitly by the module.</p></div><a name="INDEX-2661" /><a name="INDEX-2662" /><a name="INDEX-2663" /><a name="INDEX-2664" /><a name="INDEX-2665" /><a name="INDEX-2666" /><a name="INDEX-2667" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>user</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>$<em class="replaceable">url</em>->user([<em class="replaceable">username</em>])</pre><p><a name="INDEX-2661" />When invoked with no parameters, thismethod returns the user for the URL defined in the object. Wheninvoked with a parameter, the object's user isassigned to that value.<a name="INDEX-2662" /><a name="INDEX-2663" /><a name="INDEX-2664" /><a name="INDEX-2665" /><a name="INDEX-2666" /><a name="INDEX-2667" /> </p></div></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch20_04.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td align="right" valign="top" width="228"><a href="part9.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">20.4. The HTML Modules</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td align="right" valign="top" width="228">IX. Perl/Tk</td></tr></table></div><hr width="684" align="left" /><img src="../gifs/navbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links" /><p><p><font size="-1"><a href="copyrght.htm">Copyright © 2002</a> O'Reilly & Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -