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

📄 ch22_01.htm

📁 by Randal L. Schwartz and Tom Phoenix ISBN 0-596-00132-0 Third Edition, published July 2001. (See
💻 HTM
字号:
<html><head><title>Win32 Modules and Extensions (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 &amp; 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="part10.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_02.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h1 class="chapter">Chapter 22. Win32 Modules and Extensions</h1><div class="htmltoc"><h4 class="tochead">Contents:</h4>  <p> <a href="#perlnut2-CHP-22-SECT-1">Win32::Clipboard</a><br /><a href="ch22_02.htm">Win32::Console</a><br /><a href="ch22_03.htm">Win32::ChangeNotify</a><br /><a href="ch22_04.htm">Win32::Eventlog</a><br /><a href="ch22_05.htm">Win32::File</a><br /><a href="ch22_06.htm">Win32::FileSecurity</a><br /><a href="ch22_07.htm">Win32::Internet</a><br /><a href="ch22_08.htm">Win32::IPC</a><br /><a href="ch22_09.htm">Win32::Mutex</a><br /><a href="ch22_10.htm">Win32::NetAdmin</a><br /><a href="ch22_11.htm">Win32::NetResource</a><br /><a href="ch22_12.htm">Win32::PerfLib</a><br /><a href="ch22_13.htm">Win32::Pipe</a><br /><a href="ch22_14.htm">Win32::Process</a><br /><a href="ch22_15.htm">Win32::Registry</a><br /><a href="ch22_16.htm">Win32::Semaphore</a><br /><a href="ch22_17.htm">Win32::Service</a><br /><a href="ch22_18.htm">Win32::Shortcut</a><br /><a href="ch22_19.htm">Win32 Extensions</a><br /></p></div><p>If you use Perl on a Win32 system, a number of extension modules areavailable to provide Windows-specific functionality. Extensionmodules consist of a regular module written in Perl and a librarywritten in C or C++ that can implement native Windows calls. The coreof available modules <a name="INDEX-3167" /></a><a name="INDEX-3168" /></a>is bundled together as<em class="emphasis">lib-win32</em> on CPAN, and with ActivePerl,Activestate's version of Perl for Win32. Theyprovide such functionality as managing Windows processes, NT useradministration, registry modification, and OLE automation.</p><p>The Win32 modules were originally written for Windows NT systems, somuch of the functionality of the Win32 library is applicable only toPerl running on Windows NT. Many modules check to see which systemthey are on before installing. Many of the NT-specific modules suchas NetAdmin and EventLog do not install at all on Windows 95. Modulessuch as Registry do their best to work on both systems, despite thedifferences in their registries.</p><p>This chapter covers most of the modules and extensions included in<em class="emphasis">lib-win32</em> and distributed with ActivePerl.Additional Windows modules are available at CPAN.</p><p>The following modules are described in this chapter:</p><dl><dt><i>Win32::Clipboard</i></dt><dd>Provides Windows clipboard interaction<p></p></dd><dt><i>Win32::Console</i></dt><dd>Provides Windows console interaction<p></p></dd><dt><i>Win32::ChangeNotify</i></dt><dd>Creates and uses ChangeNotify objects<p></p></dd><dt><i>Win32::EventLog</i></dt><dd>Reads from and writes to the Windows NT event log<p></p></dd><dt><i>Win32::File</i></dt><dd>Manages file attributes (read-only, system, hidden, etc.)<p></p></dd><dt><i>Win32::FileSecurity</i></dt><dd>Manages ACLs in Perl<p></p></dd><dt><i>Win32::Internet</i></dt><dd>Provides extensions for Internet services<p></p></dd><dt><i>Win32::IPC</i></dt><dd>Waits for objects (processes, mutexes, semaphores)<p></p></dd><dt><i>Win32::Mutex</i></dt><dd>Creates and uses mutexes<p></p></dd><dt><i>Win32::NetAdmin</i></dt><dd>Administers users and groups<p></p></dd><dt><i>Win32::NetResource</i></dt><dd>Manages resources (servers, file shares, printers)<p></p></dd><dt><i>Win32::PerfLib</i></dt><dd>Accesses the Windows NT Performance Counter<p></p></dd><dt><i>Win32::Pipe</i></dt><dd>Creates a named pipe under Win32<p></p></dd><dt><i>Win32::Process</i></dt><dd>Starts and stops Win32 processes<p></p></dd><dt><i>Win32::Registry</i></dt><dd>Reads and manages the Win32 Registry<p></p></dd><dt><i>Win32::Semaphore</i></dt><dd>Creates and uses semaphores<p></p></dd><dt><i>Win32::Service</i></dt><dd>Manages Windows NT services<p></p></dd><dt><i>Win32::Shortcut</i></dt><dd>Provides shell link interface<p></p></dd></dl><p>In addition to this chapter, <a href="ch23_01.htm">Chapter 23, "OLE Automation"</a> covers theWin32::OLE modules, and <a href="ch24_01.htm">Chapter 24, "ODBC Extension for Win32"</a> covers the ODBCextension for Win32.</p><p><a name="INDEX-3169" /></a>The referencematerial for the Clipboard, Console, Internet, and Shortcut moduleswas graciously provided by Aldo Capini, author and maintainer of manyWin32 modules (<a href="http://dada.perl.it/">http://dada.perl.it/</a>).</p><div class="sect1"><a name="perlnut2-CHP-22-SECT-1" /></a><h2 class="sect1">22.1. Win32::Clipboard</h2><p><a name="INDEX-3170" /></a><a name="INDEX-3171" /></a><a name="INDEX-3172" /></a>The Win32::Clipboard module allows youto manipulate the Windows clipboard. You can use the clipboard as anobject with the following syntax:</p><blockquote><pre class="code">$clip = Win32::Clipboard( );</pre></blockquote><p>This functions as an implicit constructor. If you include a textstring as an argument, that text will be placed on the clipboard. Youcan use the package-qualified method names instead of the objectsyntax, since the clipboard is a single entity:</p><blockquote><pre class="code">$text = Win32::Clipboard::Get( );Win32::Clipboard::Set("blah blah blah");Win32::Clipboard::Empty( );</pre></blockquote><p>Alternatively, you can use the clipboard as an object with thissyntax:</p><blockquote><pre class="code">$Clip = Win32::Clipboard( );$text = $Clip-&gt;Get( );$Clip-&gt;Set("blah blah blah");$Clip-&gt;Empty( );</pre></blockquote></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="part10.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="ch22_02.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">X. Win32</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">22.2. Win32::Console</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 &copy; 2002</a> O'Reilly &amp; 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 + -