📄 ch22_11.htm
字号:
<html><head><title>Win32::NetResource (Perl in a Nutshell, 2nd Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Stephen Spainhour" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly & Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="0596002416L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="Perl in a Nutshell, 2nd Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Java and XSLT" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch22_10.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="ch22_12.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">22.11. Win32::NetResource</h2><p><a name="INDEX-3308" /><a name="INDEX-3309" /><a name="INDEX-3310" /><a name="INDEX-3311" />The Win32::NetResource module allows you tomanage shared resources on a network, such as printers, disks, etc.Two data structures are used to provide or store information for manyof the NetResource functions. The first is the<tt class="literal">share_info</tt> hash. This hash contains parameters forsetting up a share, using the following structure:</p><blockquote><pre class="code">%share_info = ( netname => "<em class="replaceable"><tt>name of share</tt></em>", type => "<em class="replaceable"><tt>type of share</tt></em>", remark => "<em class="replaceable"><tt>a string comment</tt></em>", permissions => "<em class="replaceable"><tt>permissions value</tt></em>", maxusers => "<em class="replaceable"><tt>the max number of users</tt></em>", current-users => "<em class="replaceable"><tt>the current number of users</tt></em>", path => "<em class="replaceable"><tt>the path of the share</tt></em>", passwd => "<em class="replaceable"><tt>password, if required</tt></em>");</pre></blockquote><p><a name="INDEX-3312" />A<tt class="literal">netresource</tt> data structure contains informationabout the shared resource or device. It has the following structure:</p><blockquote><pre class="code">%netresource = ( 'Scope' => "<em class="replaceable"><tt>Scope of a resource connection (see list below for </tt></em> <em class="replaceable"><tt>values</tt></em>)", 'Type' => "<em class="replaceable"><tt>The type of resource (see list below)</tt></em>", 'DisplayType' => "<em class="replaceable"><tt>How the resource should be displayed (see list</tt></em><em class="replaceable"><tt> below</tt></em>)", 'Usage' => "<em class="replaceable"><tt>How the resource should be used</tt></em>", 'LocalName' => "<em class="replaceable"><tt>Name of the local device the resource is connected </tt></em> <em class="replaceable"><tt>to</tt></em>", 'RemoteName' => "<em class="replaceable"><tt>Network name of the resource</tt></em>", 'Comment' => "<em class="replaceable"><tt>Comment string</tt></em>", 'Provider' => "<em class="replaceable"><tt>Provider of the resource</tt></em>");</pre></blockquote><p>The first three elements of the <tt class="literal">netresource</tt> hashcontain values described in the following lists. The<tt class="literal">Scope</tt> value can be one of the following:</p><dl><dt><b><tt class="literal">RESOURCE_CONNECTED</tt></b></dt><dd>Resource is already connected</p></dd><dt><b><tt class="literal">RESOURCE_REMEMBERED</tt></b></dt><dd>Resource is reconnected each time the user logs on</p></dd><dt><b><tt class="literal">RESOURCE_GLOBALNET</tt></b></dt><dd>Resource is available to the entire network</p></dd></dl><p>The <tt class="literal">Type</tt> element takes one of the followingvalues:</p><dl><dt><b><tt class="literal">RESOURCETYPE_ANY</tt></b></dt><dd>All resources</p></dd><dt><b><tt class="literal">RESOURCETYPE_DISK</tt></b></dt><dd>Disk resources</p></dd><dt><b><tt class="literal">RESOURCETYPE_PRINT</tt></b></dt><dd>Print resources</p></dd></dl><p>The <tt class="literal">Display</tt> element can be one of these values: </p><dl><dt><b><tt class="literal">RESOURCEDISPLAYTYPE_DOMAIN</tt></b></dt><dd>Object is displayed as a domain </p></dd><dt><b><tt class="literal">RESOURCEDISPLAYTYPE_SERVER</tt></b></dt><dd>Object is displayed as a server</p></dd><dt><b><tt class="literal">RESOURCEDISPLAYTYPE_SHARE</tt></b></dt><dd>Object is displayed as a sharepoint</p></dd><dt><b><tt class="literal">RESOURCEUSAGE_CONNECTABLE</tt></b></dt><dd>Resource can be connected to a local device</p></dd><dt><b><tt class="literal">RESOURCEUSAGE_CONTAINER</tt></b></dt>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -