<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>perl — Waf 1.7.11 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '1.7.11', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="author" title="About these documents" href="../about.html" /> <link rel="copyright" title="Copyright" href="../copyright.html" /> <link rel="top" title="Waf 1.7.11 documentation" href="../index.html" /> <link rel="up" title="Waf Tools" href="../tools.html" /> <link rel="next" title="python" href="python.html" /> <link rel="prev" title="kde4" href="kde4.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="python.html" title="python" accesskey="N">next</a> |</li> <li class="right" > <a href="kde4.html" title="kde4" accesskey="P">previous</a> |</li> <li><a href="../index.html">Waf 1.7.11 documentation</a> »</li> <li><a href="../tools.html" accesskey="U">Waf Tools</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-waflib.Tools.perl"> <span id="perl"></span><h1>perl<a class="headerlink" href="#module-waflib.Tools.perl" title="Permalink to this headline">¶</a></h1> <p>Support for Perl extensions. A C/C++ compiler is required:</p> <div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">options</span><span class="p">(</span><span class="n">opt</span><span class="p">):</span> <span class="n">opt</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s">'compiler_c perl'</span><span class="p">)</span> <span class="k">def</span> <span class="nf">configure</span><span class="p">(</span><span class="n">conf</span><span class="p">):</span> <span class="n">conf</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s">'compiler_c perl'</span><span class="p">)</span> <span class="n">conf</span><span class="o">.</span><span class="n">check_perl_version</span><span class="p">((</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">0</span><span class="p">))</span> <span class="n">conf</span><span class="o">.</span><span class="n">check_perl_ext_devel</span><span class="p">()</span> <span class="n">conf</span><span class="o">.</span><span class="n">check_perl_module</span><span class="p">(</span><span class="s">'Cairo'</span><span class="p">)</span> <span class="n">conf</span><span class="o">.</span><span class="n">check_perl_module</span><span class="p">(</span><span class="s">'Devel::PPPort 4.89'</span><span class="p">)</span> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="n">bld</span><span class="p">):</span> <span class="n">bld</span><span class="p">(</span> <span class="n">features</span> <span class="o">=</span> <span class="s">'c cshlib perlext'</span><span class="p">,</span> <span class="n">source</span> <span class="o">=</span> <span class="s">'Mytest.xs'</span><span class="p">,</span> <span class="n">target</span> <span class="o">=</span> <span class="s">'Mytest'</span><span class="p">,</span> <span class="n">install_path</span> <span class="o">=</span> <span class="s">'${ARCHDIR_PERL}/auto'</span><span class="p">)</span> <span class="n">bld</span><span class="o">.</span><span class="n">install_files</span><span class="p">(</span><span class="s">'${ARCHDIR_PERL}'</span><span class="p">,</span> <span class="s">'Mytest.pm'</span><span class="p">)</span> </pre></div> </div> <dl class="function"> <dt id="waflib.Tools.perl.init_perlext"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">init_perlext</tt><big>(</big><em>self</em><big>)</big><a class="reference internal" href="../_modules/waflib/Tools/perl.html#init_perlext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#waflib.Tools.perl.init_perlext" title="Permalink to this definition">¶</a></dt> <dd><p>Task generator method</p> <p>Change the values of <em>cshlib_PATTERN</em> and <em>cxxshlib_PATTERN</em> to remove the <em>lib</em> prefix from library names.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Feature :</th><td class="field-body"><a class="reference external" href="../featuremap.html#feature-perlext">perlext</a></td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="waflib.Tools.perl.xsubpp_file"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">xsubpp_file</tt><big>(</big><em>self</em>, <em>node</em><big>)</big><a class="reference internal" href="../_modules/waflib/Tools/perl.html#xsubpp_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#waflib.Tools.perl.xsubpp_file" title="Permalink to this definition">¶</a></dt> <dd><p>Create <a class="reference internal" href="#waflib.Tools.perl.xsubpp" title="waflib.Tools.perl.xsubpp"><tt class="xref py py-class docutils literal"><span class="pre">waflib.Tools.perl.xsubpp</span></tt></a> tasks to process <em>.xs</em> files</p> </dd></dl> <dl class="class"> <dt id="waflib.Tools.perl.xsubpp"> <em class="property">class </em><tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">xsubpp</tt><big>(</big><em>*k</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/waflib/Tools/perl.html#xsubpp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#waflib.Tools.perl.xsubpp" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="../Task.html#waflib.Task.Task" title="waflib.Task.Task"><tt class="xref py py-class docutils literal"><span class="pre">waflib.Task.Task</span></tt></a></p> <p>Process <em>.xs</em> files</p> <dl class="attribute"> <dt id="waflib.Tools.perl.xsubpp.color"> <tt class="descname">color</tt><em class="property"> = 'BLUE'</em><a class="headerlink" href="#waflib.Tools.perl.xsubpp.color" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="waflib.Tools.perl.xsubpp.ext_out"> <tt class="descname">ext_out</tt><em class="property"> = ['.h']</em><a class="headerlink" href="#waflib.Tools.perl.xsubpp.ext_out" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="waflib.Tools.perl.xsubpp.__doc__"> <tt class="descname">__doc__</tt><em class="property"> = '\n\tProcess *.xs* files\n\t'</em><a class="headerlink" href="#waflib.Tools.perl.xsubpp.__doc__" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="waflib.Tools.perl.xsubpp.__module__"> <tt class="descname">__module__</tt><em class="property"> = 'waflib.Tools.perl'</em><a class="headerlink" href="#waflib.Tools.perl.xsubpp.__module__" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="waflib.Tools.perl.xsubpp.hcode"> <tt class="descname">hcode</tt><em class="property"> = '${PERL} ${XSUBPP} -noprototypes -typemap ${EXTUTILS_TYPEMAP} ${SRC} > ${TGT}'</em><a class="headerlink" href="#waflib.Tools.perl.xsubpp.hcode" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="waflib.Tools.perl.xsubpp.vars"> <tt class="descname">vars</tt><em class="property"> = ['EXTUTILS_TYPEMAP', 'PERL', 'XSUBPP']</em><a class="headerlink" href="#waflib.Tools.perl.xsubpp.vars" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="function"> <dt id="waflib.Tools.perl.check_perl_version"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">check_perl_version</tt><big>(</big><em>self</em>, <em>minver=None</em><big>)</big><a class="reference internal" href="../_modules/waflib/Tools/perl.html#check_perl_version"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#waflib.Tools.perl.check_perl_version" title="Permalink to this definition">¶</a></dt> <dd><p>Configuration Method bound to <a class="reference internal" href="../Configure.html#waflib.Configure.ConfigurationContext" title="waflib.Configure.ConfigurationContext"><tt class="xref py py-class docutils literal"><span class="pre">waflib.Configure.ConfigurationContext</span></tt></a></p> <p>Check if Perl is installed, and set the variable PERL. minver is supposed to be a tuple</p> </dd></dl> <dl class="function"> <dt id="waflib.Tools.perl.check_perl_module"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">check_perl_module</tt><big>(</big><em>self</em>, <em>module</em><big>)</big><a class="reference internal" href="../_modules/waflib/Tools/perl.html#check_perl_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#waflib.Tools.perl.check_perl_module" title="Permalink to this definition">¶</a></dt> <dd><p>Configuration Method bound to <a class="reference internal" href="../Configure.html#waflib.Configure.ConfigurationContext" title="waflib.Configure.ConfigurationContext"><tt class="xref py py-class docutils literal"><span class="pre">waflib.Configure.ConfigurationContext</span></tt></a></p> <p>Check if specified perlmodule is installed.</p> <p>The minimum version can be specified by specifying it after modulename like this:</p> <div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">configure</span><span class="p">(</span><span class="n">conf</span><span class="p">):</span> <span class="n">conf</span><span class="o">.</span><span class="n">check_perl_module</span><span class="p">(</span><span class="s">"Some::Module 2.92"</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="waflib.Tools.perl.check_perl_ext_devel"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">check_perl_ext_devel</tt><big>(</big><em>self</em><big>)</big><a class="reference internal" href="../_modules/waflib/Tools/perl.html#check_perl_ext_devel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#waflib.Tools.perl.check_perl_ext_devel" title="Permalink to this definition">¶</a></dt> <dd><p>Configuration Method bound to <a class="reference internal" href="../Configure.html#waflib.Configure.ConfigurationContext" title="waflib.Configure.ConfigurationContext"><tt class="xref py py-class docutils literal"><span class="pre">waflib.Configure.ConfigurationContext</span></tt></a></p> <p>Check for configuration needed to build perl extensions.</p> <p>Sets different xxx_PERLEXT variables in the environment.</p> <p>Also sets the ARCHDIR_PERL variable useful as installation path, which can be overridden by <tt class="docutils literal"><span class="pre">--with-perl-archdir</span></tt> option.</p> </dd></dl> <dl class="function"> <dt id="waflib.Tools.perl.options"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">options</tt><big>(</big><em>opt</em><big>)</big><a class="reference internal" href="../_modules/waflib/Tools/perl.html#options"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#waflib.Tools.perl.options" title="Permalink to this definition">¶</a></dt> <dd><p>Add the <tt class="docutils literal"><span class="pre">--with-perl-archdir</span></tt> and <tt class="docutils literal"><span class="pre">--with-perl-binary</span></tt> command-line options.</p> </dd></dl> <dl class="function"> <dt id="waflib.Tools.perl.extension"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">extension</tt><big>(</big><em>*k</em><big>)</big><a class="headerlink" href="#waflib.Tools.perl.extension" title="Permalink to this definition">¶</a></dt> <dd><p>Decorator: register a task generator method which will be invoked during the processing of source files for the extension given:</p> <div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">waflib</span> <span class="kn">import</span> <span class="n">Task</span> <span class="k">class</span> <span class="nc">mytask</span><span class="p">(</span><span class="n">Task</span><span class="p">):</span> <span class="n">run_str</span> <span class="o">=</span> <span class="s">'cp ${SRC} ${TGT}'</span> <span class="nd">@extension</span><span class="p">(</span><span class="s">'.moo'</span><span class="p">)</span> <span class="k">def</span> <span class="nf">create_maa_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">node</span><span class="p">):</span> <span class="bp">self</span><span class="o">.</span><span class="n">create_task</span><span class="p">(</span><span class="s">'mytask'</span><span class="p">,</span> <span class="n">node</span><span class="p">,</span> <span class="n">node</span><span class="o">.</span><span class="n">change_ext</span><span class="p">(</span><span class="s">'.maa'</span><span class="p">))</span> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="n">bld</span><span class="p">):</span> <span class="n">bld</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="s">'foo.moo'</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="waflib.Tools.perl.feature"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">feature</tt><big>(</big><em>*k</em><big>)</big><a class="headerlink" href="#waflib.Tools.perl.feature" title="Permalink to this definition">¶</a></dt> <dd><p>Decorator: register a task generator method that will be executed when the object attribute ‘feature’ contains the corresponding key(s):</p> <div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">waflib.Task</span> <span class="kn">import</span> <span class="n">feature</span> <span class="nd">@feature</span><span class="p">(</span><span class="s">'myfeature'</span><span class="p">)</span> <span class="k">def</span> <span class="nf">myfunction</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="k">print</span><span class="p">(</span><span class="s">'that is my feature!'</span><span class="p">)</span> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="n">bld</span><span class="p">):</span> <span class="n">bld</span><span class="p">(</span><span class="n">features</span><span class="o">=</span><span class="s">'myfeature'</span><span class="p">)</span> </pre></div> </div> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>k</strong> (<em>list of string</em>) – feature names</td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="waflib.Tools.perl.conf"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">conf</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#waflib.Tools.perl.conf" title="Permalink to this definition">¶</a></dt> <dd><p>Decorator: attach new configuration functions to <a class="reference internal" href="../Build.html#waflib.Build.BuildContext" title="waflib.Build.BuildContext"><tt class="xref py py-class docutils literal"><span class="pre">waflib.Build.BuildContext</span></tt></a> and <a class="reference internal" href="../Configure.html#waflib.Configure.ConfigurationContext" title="waflib.Configure.ConfigurationContext"><tt class="xref py py-class docutils literal"><span class="pre">waflib.Configure.ConfigurationContext</span></tt></a>. The methods bound will accept a parameter named ‘mandatory’ to disable the configuration errors:</p> <div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">configure</span><span class="p">(</span><span class="n">conf</span><span class="p">):</span> <span class="n">conf</span><span class="o">.</span><span class="n">find_program</span><span class="p">(</span><span class="s">'abc'</span><span class="p">,</span> <span class="n">mandatory</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span> </pre></div> </div> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>f</strong> (<em>function</em>) – method to bind</td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="waflib.Tools.perl.before_method"> <tt class="descclassname">waflib.Tools.perl.</tt><tt class="descname">before_method</tt><big>(</big><em>*k</em><big>)</big><a class="headerlink" href="#waflib.Tools.perl.before_method" title="Permalink to this definition">¶</a></dt> <dd><p>Decorator: register a task generator method which will be executed before the functions of given name(s):</p> <div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">waflib.TaskGen</span> <span class="kn">import</span> <span class="n">feature</span><span class="p">,</span> <span class="n">before</span> <span class="nd">@feature</span><span class="p">(</span><span class="s">'myfeature'</span><span class="p">)</span> <span class="nd">@before_method</span><span class="p">(</span><span class="s">'fun2'</span><span class="p">)</span> <span class="k">def</span> <span class="nf">fun1</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="k">print</span><span class="p">(</span><span class="s">'feature 1!'</span><span class="p">)</span> <span class="nd">@feature</span><span class="p">(</span><span class="s">'myfeature'</span><span class="p">)</span> <span class="k">def</span> <span class="nf">fun2</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="k">print</span><span class="p">(</span><span class="s">'feature 2!'</span><span class="p">)</span> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="n">bld</span><span class="p">):</span> <span class="n">bld</span><span class="p">(</span><span class="n">features</span><span class="o">=</span><span class="s">'myfeature'</span><span class="p">)</span> </pre></div> </div> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>k</strong> (<em>list of string</em>) – method names</td> </tr> </tbody> </table> </dd></dl> <p>Features defined in this module:</p> <ul class="simple"> <li><a class="reference external" href="../featuremap.html#feature-perlext">perlext</a></li> </ul> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="kde4.html" title="previous chapter">kde4</a></p> <h4>Next topic</h4> <p class="topless"><a href="python.html" title="next chapter">python</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/tools/perl.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="python.html" title="python" >next</a> |</li> <li class="right" > <a href="kde4.html" title="kde4" >previous</a> |</li> <li><a href="../index.html">Waf 1.7.11 documentation</a> »</li> <li><a href="../tools.html" >Waf Tools</a> »</li> </ul> </div> <div class="footer"> © <a href="../copyright.html">Copyright</a> 2010, Thomas Nagy. </div> </body> </html>