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

📄 appb_24.htm

📁 by Randal L. Schwartz and Tom Phoenix ISBN 0-596-00132-0 Third Edition, published July 2001. (See
💻 HTM
字号:
<html><head><title>Embedding (Learning Perl, 3rd Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Randal L. Schwartz and Tom Phoenix" /><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="0596001320L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="Learning Perl, 3rd Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img alt="Book Home" border="0" src="gifs/smbanner.gif" usemap="#banner-map" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Learning Perl, 3rd Edition" /><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="appb_23.htm"><img alt="Previous" border="0" src="../gifs/txtpreva.gif" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"></a></td><td align="right" valign="top" width="228"><a href="appb_25.htm"><img alt="Next" border="0" src="../gifs/txtnexta.gif" /></a></td></tr></table></div><h2 class="sect1">B.24. Embedding</h2><p>The reverse of dynamic loading (in a sense) is<a name="INDEX-1315" /><a name="INDEX-1316" />embedding.</p><p>Suppose you want to make a really cool word processor, and you startwriting it in (say) C++.<a href="#FOOTNOTE-420">[420]</a> Now, you decide you want theusers to be able to use Perl's regular expressions for anextra-powerful search-and-replace feature, so you embed Perl intoyour program. Then you realize that you could open up some of thepower of Perl to your users. A power user could write a subroutine inPerl that could become a menu item in your program. Users cancustomize the operation of your word processor by writing a littlePerl. Now you open up a little space on your website where users canshare and exchange these Perl snippets, and you've gotthousands of new programmers extending what your program can do at noextra cost to your company. And how much do you have to pay Larry forall this? Nothing -- see the <a name="INDEX-1317" />licenses that come with Perl. Larry is areally nice guy. You should at least send him a thank-you note.</p><blockquote class="footnote"> <a name="FOOTNOTE-420" /><p>[420]That's probably thelanguage we'd use for writing a word processor. Hey, we lovePerl, but we didn't swear an oath in blood to use no otherlanguage. When language X is the best choice, use language X. Butoften, X equals Perl.</p> </blockquote><p>Although we don't know of such a word processor, some folkshave already used this technique to make other powerful programs. Onesuch example is Apache's<tt class="literal">mod_perl</tt><a name="INDEX-1318" />, which embeds Perl into analready-powerful web server. If you're thinking about embeddingPerl, you should check out <tt class="literal">mod_perl</tt>; sinceit's all open source, you can see just how it works.</p><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="appb_23.htm"><img alt="Previous" border="0" src="../gifs/txtpreva.gif" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img alt="Home" border="0" src="../gifs/txthome.gif" /></a></td><td align="right" valign="top" width="228"><a href="appb_25.htm"><img alt="Next" border="0" src="../gifs/txtnexta.gif" /></a></td></tr><tr><td align="left" valign="top" width="228">B.23. Dynamic Loading</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img alt="Book Index" border="0" src="../gifs/index.gif" /></a></td><td align="right" valign="top" width="228">B.25. Converting Other Languages to Perl</td></tr></table></div><hr width="684" align="left" /><img alt="Library Navigation Links" border="0" src="../gifs/navbar.gif" usemap="#library-map" /><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 + -