CINXE.COM

perlcc - frontend for perl compiler - Perldoc Browser

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>perlcc - frontend for perl compiler - Perldoc Browser</title> <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser"> <link rel="canonical" href="https://perldoc.perl.org/perlcc"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" /> <style> body { background: #f4f4f5; color: #020202; } .navbar-dark { background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%); background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%); background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0); background-repeat: repeat-x; } .navbar-dark .navbar-nav .nav-link, .navbar-dark .navbar-nav .nav-link:focus { color: #fff } .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 } #wrapperlicious { margin: 0 auto; font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; font-weight: normal; line-height: 1.5em; margin: 0; padding: 0; } #wrapperlicious h1 { font-size: 1.5em } #wrapperlicious h2 { font-size: 1.3em } #wrapperlicious h3 { font-size: 1.1em } #wrapperlicious h4 { font-size: 0.9em } #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3, #wrapperlicious h4, #wrapperlicious dt { color: #020202; margin-top: 1em; margin-bottom: 1em; position: relative; font-weight: bold; } #wrapperlicious a { color: inherit; text-decoration: underline } #wrapperlicious #toc { text-decoration: none } #wrapperlicious a:hover { color: #2a2a2a } #wrapperlicious a img { border: 0 } #wrapperlicious :not(pre) > code { color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; font: 0.9em Consolas, Menlo, Monaco, monospace; padding: 0.3em; } #wrapperlicious dd { margin: 0; margin-left: 2em; } #wrapperlicious dt { color: #2a2a2a; font-weight: bold; margin-left: 0.9em; } #wrapperlicious p { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious li > p { margin-bottom: 0; margin-top: 0; } #wrapperlicious pre { border: 1px solid #c1c1c1; border-radius: 3px; font: 100% Consolas, Menlo, Monaco, monospace; margin-bottom: 1em; margin-top: 1em; } #wrapperlicious pre > code { display: block; background-color: #f6f6f6; font: 0.9em Consolas, Menlo, Monaco, monospace; line-height: 1.5em; text-align: left; white-space: pre; padding: 1em; } #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious ul { list-style-type: square; } #wrapperlicious ul ul { margin-bottom: 0px; margin-top: 0px; } #footer { font-size: 0.8em; padding-top: 0.5em; text-align: center; } #more { display: inline; font-size: 0.8em; } #perldocdiv { background-color: #fff; border: 1px solid #c1c1c1; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-left: auto; margin-right: auto; padding: 3em; padding-top: 1em; max-width: 960px; } #moduleversion { float: right } #wrapperlicious .leading-notice { font-style: italic; padding-left: 1em; margin-top: 1em; margin-bottom: 1em; } #wrapperlicious .permalink { display: none; left: -0.75em; position: absolute; padding-right: 0.25em; text-decoration: none; } #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink, #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink, #wrapperlicious dt:hover .permalink { display: block; } </style> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KVNWBNT5FB'); gtag('config', 'UA-50555-3'); </script> </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="/"><img src="/images/perl_camel_30.png" width="30" height="30" class="d-inline-block align-top" alt="Perl Camel Logo"> Perldoc Browser</a> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.6.0</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-stable"> <a class="dropdown-item" href="/perlcc">Latest</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1/perlcc">5.40.1</a> <a class="dropdown-item" href="/5.40.0/perlcc">5.40.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3/perlcc">5.38.3</a> <a class="dropdown-item" href="/5.38.2/perlcc">5.38.2</a> <a class="dropdown-item" href="/5.38.1/perlcc">5.38.1</a> <a class="dropdown-item" href="/5.38.0/perlcc">5.38.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.36.3/perlcc">5.36.3</a> <a class="dropdown-item" href="/5.36.2/perlcc">5.36.2</a> <a class="dropdown-item" href="/5.36.1/perlcc">5.36.1</a> <a class="dropdown-item" href="/5.36.0/perlcc">5.36.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.34.3/perlcc">5.34.3</a> <a class="dropdown-item" href="/5.34.2/perlcc">5.34.2</a> <a class="dropdown-item" href="/5.34.1/perlcc">5.34.1</a> <a class="dropdown-item" href="/5.34.0/perlcc">5.34.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.32.1/perlcc">5.32.1</a> <a class="dropdown-item" href="/5.32.0/perlcc">5.32.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.30.3/perlcc">5.30.3</a> <a class="dropdown-item" href="/5.30.2/perlcc">5.30.2</a> <a class="dropdown-item" href="/5.30.1/perlcc">5.30.1</a> <a class="dropdown-item" href="/5.30.0/perlcc">5.30.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.28.3/perlcc">5.28.3</a> <a class="dropdown-item" href="/5.28.2/perlcc">5.28.2</a> <a class="dropdown-item" href="/5.28.1/perlcc">5.28.1</a> <a class="dropdown-item" href="/5.28.0/perlcc">5.28.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.26.3/perlcc">5.26.3</a> <a class="dropdown-item" href="/5.26.2/perlcc">5.26.2</a> <a class="dropdown-item" href="/5.26.1/perlcc">5.26.1</a> <a class="dropdown-item" href="/5.26.0/perlcc">5.26.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.24.4/perlcc">5.24.4</a> <a class="dropdown-item" href="/5.24.3/perlcc">5.24.3</a> <a class="dropdown-item" href="/5.24.2/perlcc">5.24.2</a> <a class="dropdown-item" href="/5.24.1/perlcc">5.24.1</a> <a class="dropdown-item" href="/5.24.0/perlcc">5.24.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.22.4/perlcc">5.22.4</a> <a class="dropdown-item" href="/5.22.3/perlcc">5.22.3</a> <a class="dropdown-item" href="/5.22.2/perlcc">5.22.2</a> <a class="dropdown-item" href="/5.22.1/perlcc">5.22.1</a> <a class="dropdown-item" href="/5.22.0/perlcc">5.22.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.20.3/perlcc">5.20.3</a> <a class="dropdown-item" href="/5.20.2/perlcc">5.20.2</a> <a class="dropdown-item" href="/5.20.1/perlcc">5.20.1</a> <a class="dropdown-item" href="/5.20.0/perlcc">5.20.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/perlcc">5.18.4</a> <a class="dropdown-item" href="/5.18.3/perlcc">5.18.3</a> <a class="dropdown-item" href="/5.18.2/perlcc">5.18.2</a> <a class="dropdown-item" href="/5.18.1/perlcc">5.18.1</a> <a class="dropdown-item" href="/5.18.0/perlcc">5.18.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.16.3/perlcc">5.16.3</a> <a class="dropdown-item" href="/5.16.2/perlcc">5.16.2</a> <a class="dropdown-item" href="/5.16.1/perlcc">5.16.1</a> <a class="dropdown-item" href="/5.16.0/perlcc">5.16.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.14.4/perlcc">5.14.4</a> <a class="dropdown-item" href="/5.14.3/perlcc">5.14.3</a> <a class="dropdown-item" href="/5.14.2/perlcc">5.14.2</a> <a class="dropdown-item" href="/5.14.1/perlcc">5.14.1</a> <a class="dropdown-item" href="/5.14.0/perlcc">5.14.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.5/perlcc">5.12.5</a> <a class="dropdown-item" href="/5.12.4/perlcc">5.12.4</a> <a class="dropdown-item" href="/5.12.3/perlcc">5.12.3</a> <a class="dropdown-item" href="/5.12.2/perlcc">5.12.2</a> <a class="dropdown-item" href="/5.12.1/perlcc">5.12.1</a> <a class="dropdown-item" href="/5.12.0/perlcc">5.12.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/perlcc">5.10.1</a> <a class="dropdown-item" href="/5.10.0/perlcc">5.10.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.9/perlcc">5.8.9</a> <a class="dropdown-item" href="/5.8.8/perlcc">5.8.8</a> <a class="dropdown-item" href="/5.8.7/perlcc">5.8.7</a> <a class="dropdown-item" href="/5.8.6/perlcc">5.8.6</a> <a class="dropdown-item" href="/5.8.5/perlcc">5.8.5</a> <a class="dropdown-item" href="/5.8.4/perlcc">5.8.4</a> <a class="dropdown-item" href="/5.8.3/perlcc">5.8.3</a> <a class="dropdown-item" href="/5.8.2/perlcc">5.8.2</a> <a class="dropdown-item" href="/5.8.1/perlcc">5.8.1</a> <a class="dropdown-item" href="/5.8.0/perlcc">5.8.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.2/perlcc">5.6.2</a> <a class="dropdown-item" href="/5.6.1/perlcc">5.6.1</a> <a class="dropdown-item active" href="/5.6.0/perlcc">5.6.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_04/perlcc">5.005_04</a> <a class="dropdown-item" href="/5.005_03/perlcc">5.005_03</a> <a class="dropdown-item" href="/5.005_02/perlcc">5.005_02</a> <a class="dropdown-item" href="/5.005_01/perlcc">5.005_01</a> <a class="dropdown-item" href="/5.005/perlcc">5.005</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-dev"> <a class="dropdown-item" href="/blead/perlcc">blead</a> <a class="dropdown-item" href="/5.41.9/perlcc">5.41.9</a> <a class="dropdown-item" href="/5.41.8/perlcc">5.41.8</a> <a class="dropdown-item" href="/5.41.7/perlcc">5.41.7</a> <a class="dropdown-item" href="/5.41.6/perlcc">5.41.6</a> <a class="dropdown-item" href="/5.41.5/perlcc">5.41.5</a> <a class="dropdown-item" href="/5.41.4/perlcc">5.41.4</a> <a class="dropdown-item" href="/5.41.3/perlcc">5.41.3</a> <a class="dropdown-item" href="/5.41.2/perlcc">5.41.2</a> <a class="dropdown-item" href="/5.41.1/perlcc">5.41.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1-RC1/perlcc">5.40.1-RC1</a> <a class="dropdown-item" href="/5.40.0-RC2/perlcc">5.40.0-RC2</a> <a class="dropdown-item" href="/5.40.0-RC1/perlcc">5.40.0-RC1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.39.10/perlcc">5.39.10</a> <a class="dropdown-item" href="/5.39.9/perlcc">5.39.9</a> <a class="dropdown-item" href="/5.39.8/perlcc">5.39.8</a> <a class="dropdown-item" href="/5.39.7/perlcc">5.39.7</a> <a class="dropdown-item" href="/5.39.6/perlcc">5.39.6</a> <a class="dropdown-item" href="/5.39.5/perlcc">5.39.5</a> <a class="dropdown-item" href="/5.39.4/perlcc">5.39.4</a> <a class="dropdown-item" href="/5.39.3/perlcc">5.39.3</a> <a class="dropdown-item" href="/5.39.2/perlcc">5.39.2</a> <a class="dropdown-item" href="/5.39.1/perlcc">5.39.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3-RC1/perlcc">5.38.3-RC1</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-nav"> <a class="dropdown-item" href="/5.6.0/perl">Perl</a> <a class="dropdown-item" href="/5.6.0/perlintro">Intro</a> <a class="dropdown-item" href="/5.6.0/perl#Tutorials">Tutorials</a> <a class="dropdown-item" href="/5.6.0/perlfaq">FAQs</a> <a class="dropdown-item" href="/5.6.0/perl#Reference-Manual">Reference</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.0/perlop">Operators</a> <a class="dropdown-item" href="/5.6.0/functions">Functions</a> <a class="dropdown-item" href="/5.6.0/variables">Variables</a> <a class="dropdown-item" href="/5.6.0/modules">Modules</a> <a class="dropdown-item" href="/5.6.0/perlutil">Utilities</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.0/perldelta">Release Notes</a> <a class="dropdown-item" href="/5.6.0/perlcommunity">Community</a> <a class="dropdown-item" href="/5.6.0/perlhist">History</a> </div> </li> </ul> <ul class="navbar-nav"> <script> function set_expand (expand) { var perldocdiv = document.getElementById('perldocdiv'); var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width'); var expanded = (width == '' || width == 'none') ? true : false; if (expand === null) { expand = !expanded; } if ((expand && !expanded) || (!expand && expanded)) { perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px'); var button_classlist = document.getElementById('content-expand-button').classList; if (expand) { button_classlist.add('btn-light'); button_classlist.remove('btn-outline-light'); } else { button_classlist.add('btn-outline-light'); button_classlist.remove('btn-light'); } } return expand; } function toggle_expand () { var expand = set_expand(null); document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC'; } function read_expand () { return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { if (read_expand()) { set_expand(true); } }); } else if (read_expand()) { set_expand(true); } </script> <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-4" onclick="toggle_expand()">Expand</button> </ul> <form class="form-inline" method="get" action="/5.6.0/search"> <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search" value=""> </form> </div> </nav> <div id="wrapperlicious" class="container-fluid"> <div id="perldocdiv"> <div id="links"> <a href="/5.6.0/perlcc">perlcc</a> <div id="more"> (<a href="/5.6.0/perlcc.txt">source</a>, <a href="https://metacpan.org/pod/perlcc">CPAN</a>) </div> </div> <div class="leading-notice"> You are viewing the version of this documentation from Perl 5.6.0. <a href="/perlcc">View the latest version</a> </div> <h1><a id="toc">CONTENTS</a></h1> <ul> <li> <a class="text-decoration-none" href="#NAME">NAME</a> </li> <li> <a class="text-decoration-none" href="#SYNOPSIS">SYNOPSIS</a> </li> <li> <a class="text-decoration-none" href="#DESCRIPTION">DESCRIPTION</a> </li> <li> <a class="text-decoration-none" href="#OPTIONS">OPTIONS</a> </li> <li> <a class="text-decoration-none" href="#ENVIRONMENT">ENVIRONMENT</a> </li> <li> <a class="text-decoration-none" href="#FILES">FILES</a> </li> <li> <a class="text-decoration-none" href="#BUGS">BUGS</a> </li> </ul> <h1 id="NAME"><a class="permalink" href="#NAME">#</a>NAME</h1> <p>perlcc - frontend for perl compiler</p> <h1 id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">#</a>SYNOPSIS</h1> <pre><code>%prompt perlcc a.p # compiles into executable &#39;a&#39; %prompt perlcc A.pm # compile into &#39;A.so&#39; %prompt perlcc a.p -o execute # compiles &#39;a.p&#39; into &#39;execute&#39;. %prompt perlcc a.p -o execute -run # compiles &#39;a.p&#39; into execute, runs on # the fly %prompt perlcc a.p -o execute -run -argv &#39;arg1 arg2 arg3&#39; # compiles into execute, runs with # arg1 arg2 arg3 as @ARGV %prompt perlcc a.p b.p c.p -regex &#39;s/\.p/\.exe&#39; # compiles into &#39;a.exe&#39;,&#39;b.exe&#39;,&#39;c.exe&#39;. %prompt perlcc a.p -log compilelog # compiles into &#39;a&#39;, saves compilation # info into compilelog, as well # as mirroring to screen %prompt perlcc a.p -log compilelog -verbose cdf # compiles into &#39;a&#39;, saves compilation # info into compilelog, being silent # on screen. %prompt perlcc a.p -C a.c -gen # generates C code (into a.c) and # stops without compile. %prompt perlcc a.p -L ../lib a.c # Compiles with the perl libraries # inside ../lib included.</code></pre> <h1 id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">#</a>DESCRIPTION</h1> <p>&#39;perlcc&#39; is the frontend into the perl compiler. Typing &#39;perlcc a.p&#39; compiles the code inside a.p into a standalone executable, and perlcc A.pm will compile into a shared object, A.so, suitable for inclusion into a perl program via &quot;use A&quot;.</p> <p>There are quite a few flags to perlcc which help with such issues as compiling programs in bulk, testing compiled programs for compatibility with the interpreter, and controlling.</p> <h1 id="OPTIONS"><a class="permalink" href="#OPTIONS">#</a>OPTIONS</h1> <dl> <dt id="-L-&lt;-library_directories-&gt;"><a class="permalink" href="#-L-%3C-library_directories-%3E">#</a><a id="L-library_directories"></a>-L &lt; library_directories &gt;</dt> <dd> <p>Adds directories in <b>library_directories</b> to the compilation command.</p> </dd> <dt id="-I-&lt;-include_directories-&gt;"><a class="permalink" href="#-I-%3C-include_directories-%3E">#</a><a id="I-include_directories"></a>-I &lt; include_directories &gt;</dt> <dd> <p>Adds directories inside <b>include_directories</b> to the compilation command.</p> </dd> <dt id="-C-&lt;-c_code_name-&gt;"><a class="permalink" href="#-C-%3C-c_code_name-%3E">#</a><a id="C-c_code_name"></a>-C &lt; c_code_name &gt;</dt> <dd> <p>Explicitly gives the name <b>c_code_name</b> to the generated file containing the C code which is to be compiled. Can only be used if compiling one file on the command line.</p> </dd> <dt id="-o-&lt;-executable_name-&gt;"><a class="permalink" href="#-o-%3C-executable_name-%3E">#</a><a id="o-executable_name"></a>-o &lt; executable_name &gt;</dt> <dd> <p>Explicitly gives the name <b>executable_name</b> to the executable which is to be compiled. Can only be used if compiling one file on the command line.</p> </dd> <dt id="-e-&lt;-perl_line_to_execute&gt;"><a class="permalink" href="#-e-%3C-perl_line_to_execute%3E">#</a><a id="e-perl_line_to_execute"></a>-e &lt; perl_line_to_execute&gt;</dt> <dd> <p>Compiles &#39;one liners&#39;, in the same way that <b>perl -e</b> runs text strings at the command line. Default is to have the &#39;one liner&#39; be compiled, and run all in one go (see <b>-run</b>); giving the <b>-o</b> flag saves the resultant executable, rather than throwing it away. Use &#39;-argv&#39; to pass arguments to the executable created.</p> </dd> <dt id="-b"><a class="permalink" href="#-b">#</a><a id="b"></a>-b</dt> <dd> <p>Generates bytecode instead of C code.</p> </dd> <dt id="-opt"><a class="permalink" href="#-opt">#</a><a id="opt"></a>-opt</dt> <dd> <p>Uses the optimized C backend (<code>B::CC</code>)rather than the simple C backend (<code>B::C</code>). Beware that the optimized C backend creates very large switch structures and structure initializations. Many C compilers find it a challenge to compile the resulting output in finite amounts of time. Many Perl features such as <code>goto LABEL</code> are also not supported by the optimized C backend. The simple C backend should work in more instances, but can only offer modest speed increases.</p> </dd> <dt id="-regex-&lt;rename_regex&gt;"><a class="permalink" href="#-regex-%3Crename_regex%3E">#</a><a id="regex-rename_regex"></a>-regex &lt;rename_regex&gt;</dt> <dd> <p>Gives a rule <b>rename_regex</b> - which is a legal perl regular expression - to create executable file names.</p> </dd> <dt id="-verbose-&lt;verbose_level&gt;"><a class="permalink" href="#-verbose-%3Cverbose_level%3E">#</a><a id="verbose-verbose_level"></a>-verbose &lt;verbose_level&gt;</dt> <dd> <p>Show exactly what steps perlcc is taking to compile your code. You can change the verbosity level <b>verbose_level</b> much in the same way that the <code>-D</code> switch changes perl&#39;s debugging level, by giving either a number which is the sum of bits you want or a list of letters representing what you wish to see. Here are the verbosity levels so far :</p> <pre><code class="plaintext">Bit 1(g): Code Generation Errors to STDERR Bit 2(a): Compilation Errors to STDERR Bit 4(t): Descriptive text to STDERR Bit 8(f): Code Generation Errors to file (B&lt;-log&gt; flag needed) Bit 16(c): Compilation Errors to file (B&lt;-log&gt; flag needed) Bit 32(d): Descriptive text to file (B&lt;-log&gt; flag needed) </code></pre> <p>If the <b>-log</b> tag is given, the default verbose level is 63 (ie: mirroring all of perlcc&#39;s output to both the screen and to a log file). If no <b>-log</b> tag is given, then the default verbose level is 7 (ie: outputting all of perlcc&#39;s output to STDERR).</p> <p>NOTE: Because of buffering concerns, you CANNOT shadow the output of &#39;-run&#39; to both a file, and to the screen! Suggestions are welcome on how to overcome this difficulty, but for now it simply does not work properly, and hence will only go to the screen.</p> </dd> <dt id="-log-&lt;logname&gt;"><a class="permalink" href="#-log-%3Clogname%3E">#</a><a id="log-logname"></a>-log &lt;logname&gt;</dt> <dd> <p>Opens, for append, a logfile to save some or all of the text for a given compile command. No rewrite version is available, so this needs to be done manually.</p> </dd> <dt id="-argv-&lt;arguments&gt;"><a class="permalink" href="#-argv-%3Carguments%3E">#</a><a id="argv-arguments"></a>-argv &lt;arguments&gt;</dt> <dd> <p>In combination with <code>-run</code> or <code>-e</code>, tells perlcc to run the resulting executable with the string <b>arguments</b> as @ARGV.</p> </dd> <dt id="-sav"><a class="permalink" href="#-sav">#</a><a id="sav"></a>-sav</dt> <dd> <p>Tells perl to save the intermediate C code. Usually, this C code is the name of the perl code, plus &#39;.c&#39;; &#39;perlcode.p&#39; gets generated in &#39;perlcode.p.c&#39;, for example. If used with the <code>-e</code> operator, you need to tell perlcc where to save resulting executables.</p> </dd> <dt id="-gen"><a class="permalink" href="#-gen">#</a><a id="gen"></a>-gen</dt> <dd> <p>Tells perlcc to only create the intermediate C code, and not compile the results. Does an implicit <b>-sav</b>, saving the C code rather than deleting it.</p> </dd> <dt id="-run"><a class="permalink" href="#-run">#</a><a id="run"></a>-run</dt> <dd> <p>Immediately run the perl code that has been generated. NOTE: IF YOU GIVE THE <b>-run</b> FLAG TO <b>perlcc</b>, THEN THE REST OF @ARGV WILL BE INTERPRETED AS ARGUMENTS TO THE PROGRAM THAT YOU ARE COMPILING.</p> </dd> <dt id="-prog"><a class="permalink" href="#-prog">#</a><a id="prog"></a>-prog</dt> <dd> <p>Indicate that the programs at the command line are programs, and should be compiled as such. <b>perlcc</b> will automatically determine files to be programs if they have <b>.p</b>, <b>.pl</b>, <b>.bat</b> extensions.</p> </dd> <dt id="-mod"><a class="permalink" href="#-mod">#</a><a id="mod"></a>-mod</dt> <dd> <p>Indicate that the programs at the command line are modules, and should be compiled as such. <b>perlcc</b> will automatically determine files to be modules if they have the extension <b>.pm</b>.</p> </dd> </dl> <h1 id="ENVIRONMENT"><a class="permalink" href="#ENVIRONMENT">#</a>ENVIRONMENT</h1> <p>Most of the work of <b>perlcc</b> is done at the command line. However, you can change the heuristic which determines what is a module and what is a program. As indicated above, <b>perlcc</b> assumes that the extensions:</p> <p>.p$, .pl$, and .bat$</p> <p>indicate a perl program, and:</p> <p>.pm$</p> <p>indicate a library, for the purposes of creating executables. And furthermore, by default, these extensions will be replaced (and dropped) in the process of creating an executable.</p> <p>To change the extensions which are programs, and which are modules, set the environmental variables:</p> <p>PERL_SCRIPT_EXT PERL_MODULE_EXT</p> <p>These two environmental variables take colon-separated, legal perl regular expressions, and are used by perlcc to decide which objects are which. For example:</p> <p>setenv PERL_SCRIPT_EXT &#39;.prl$:.perl$&#39; prompt% perlcc sample.perl</p> <p>will compile the script &#39;sample.perl&#39; into the executable &#39;sample&#39;, and</p> <p>setenv PERL_MODULE_EXT &#39;.perlmod$:.perlmodule$&#39;</p> <p>prompt% perlcc sample.perlmod</p> <p>will compile the module &#39;sample.perlmod&#39; into the shared object &#39;sample.so&#39;</p> <p>NOTE: the &#39;.&#39; in the regular expressions for PERL_SCRIPT_EXT and PERL_MODULE_EXT is a literal &#39;.&#39;, and not a wild-card. To get a true wild-card, you need to backslash the &#39;.&#39;; as in:</p> <p>setenv PERL_SCRIPT_EXT &#39;\.\.\.\.\.&#39;</p> <p>which would have the effect of compiling ANYTHING (except what is in PERL_MODULE_EXT) into an executable with 5 less characters in its name.</p> <p>The PERLCC_OPTS environment variable can be set to the default flags that must be used by the compiler.</p> <p>The PERLCC_TIMEOUT environment variable can be set to the number of seconds to wait for the backends before giving up. This is sometimes necessary to avoid some compilers taking forever to compile the generated output. May not work on Windows and similar platforms.</p> <h1 id="FILES"><a class="permalink" href="#FILES">#</a>FILES</h1> <p>&#39;perlcc&#39; uses a temporary file when you use the <b>-e</b> option to evaluate text and compile it. This temporary file is &#39;perlc$$.p&#39;. The temporary C code is perlc$$.p.c, and the temporary executable is perlc$$.</p> <p>When you use &#39;-run&#39; and don&#39;t save your executable, the temporary executable is perlc$$</p> <h1 id="BUGS"><a class="permalink" href="#BUGS">#</a>BUGS</h1> <p>The whole compiler suite (<code>perlcc</code> included) should be considered very experimental. Use for production purposes is strongly discouraged.</p> <p>perlcc currently cannot compile shared objects on Win32. This should be fixed in future.</p> <p>Bugs in the various compiler backends still exist, and are perhaps too numerous to list here.</p> </div> <div id="footer"> <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p> <p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script src="/js/highlight.pack.js"></script> <script>hljs.highlightAll();</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10