Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2d32d4
commit 7914562
Showing
9 changed files
with
562 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<!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"> | ||
<meta name="description" content=""> | ||
<meta name="author" content=""> | ||
<link rel="icon" href="http://getbootstrap.com/favicon.ico"> | ||
|
||
<title>Inline Grant Weekly Report #7</title> | ||
|
||
<!-- Bootstrap core CSS --> | ||
<link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
|
||
<!-- Custom styles for this template --> | ||
<link href="/css/blog.css" rel="stylesheet"> | ||
<link href="/css/cog.css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<div class="blog-masthead"> | ||
<div class="container"> | ||
<nav class="blog-nav"> | ||
<a class="blog-nav-item active" href="/">Home</a> | ||
<!-- | ||
<a class="blog-nav-item" href="#">New features</a> | ||
<a class="blog-nav-item" href="#">Press</a> | ||
<a class="blog-nav-item" href="#">New hires</a> | ||
<a class="blog-nav-item" href="#">About</a> | ||
--> | ||
</nav> | ||
</div> | ||
</div> | ||
<div class="container"> | ||
<div class="blog-header"> | ||
<h1 class="blog-title"></h1> | ||
<p class="lead blog-description"></p> | ||
</div> | ||
<div class="row"> | ||
<div class="col-sm-8 blog-main"> | ||
<div class="blog-post"> | ||
<h2 class="blog-post-title">Inline Grant Weekly Report #7</h2> | ||
<p>This week made great strides for Inline::Module. Last week, we talked about <strong>auto-stubbing</strong>. That's the automatic generation of little "stub" modules that proxy invocations of <a href="https://metacpan.org/pod/Inline">Inline</a>, so we can write simple code like this:</p> | ||
|
||
<pre><code>package My::Module; | ||
use My::Module::Inline C => '... C code here ...'; | ||
</code></pre> | ||
|
||
<p>and have it do all the right things at the right times for <code>My::Module</code>. This obviously means that <code>My::Module::Inline</code> needs to exist somewhere, even though it is just a couple of lines of simple code.</p> | ||
|
||
<p>This week auto-stubbing is a reality and it works well! In fact, it turns out that the "stub" module never even needs to exist on disk. Read on!</p> | ||
|
||
<h2>Latest Developments</h2> | ||
|
||
<p>We got rid of the <code>bin</code> script: <code>perl-inline-module</code> that was used to generate stubs, like this:</p> | ||
|
||
<pre><code>perl-inline-module generate Acme::Math::XS::Inline | ||
</code></pre> | ||
|
||
<p>We replaced it with a simple one-liner:</p> | ||
|
||
<pre><code>perl -MInline::Module=makestub,Acme::Math::XS::Inline | ||
</code></pre> | ||
|
||
<p>That will generate the file: <code>lib/Acme/Math/XS/Inline.pm</code>. You can generate it under the <code>blib</code> directory like this:</p> | ||
|
||
<pre><code>perl -MInline::Module=makestub,Acme::Math::XS::Inline,blib | ||
</code></pre> | ||
|
||
<h2>Auto-Stubbing</h2> | ||
|
||
<p>I'd call that <em>Explicit Stubbing</em>. <strong>DON'T DO THAT!</strong></p> | ||
|
||
<p>Well you can if you want but the cool new way to use Inline::Module is with <strong>Auto</strong> Stubbing. Here's how you do it:</p> | ||
|
||
<pre><code>export PERL5OPT=-MInline::Module=autostub,Acme::Math::XS::Inline | ||
</code></pre> | ||
|
||
<p>Now whenever <code>Acme::Math::XS::Inline</code> is needed in development, it is provided/loaded as a Perl in-memory file object!</p> | ||
|
||
<p>You can also auto-stub to disk if you want:</p> | ||
|
||
<pre><code>export PERL5OPT=-MInline::Module=autostub,Acme::Math::XS::Inline,blib | ||
</code></pre> | ||
|
||
<p>but why would you want to? With the in-memory stubs, you don't need to worry about an extra file laying around.</p> | ||
|
||
<h2><code>blib/Inline/</code></h2> | ||
|
||
<p>This is a small change but now all the Inline build time stuff happens under the <code>blib/Inline/</code> directory. We had it building directly under <code>blib/</code> but since that is a well defined concept, it made things confusing.</p> | ||
|
||
<p>In general with this project, we are trying to extend Perl coding best-practices in ways that make XS module authoring as simple as possible, while not diverging very far from normal authoring styles.</p> | ||
|
||
<h2>Testing</h2> | ||
|
||
<p>We started writing tests that can verify all the processes we are imagining. Most of these tests so far are of the <code>xt</code> form. Since almost anything goes in <code>xt</code> I decided to write these tests in Bash instead of Perl. Since these tests are generally of the form: "run this command, in this environment and see if these files exist, etc", Bash tests make sense.</p> | ||
|
||
<p>Some time ago I ported <a href="https://github.com/ingydotnet/test-more-bash">Test::More to Bash</a>. You can run them with <code>prove</code> justlike Perl tests. The <code>prove</code> command just looks at the <em>hashbang</em> line of the <code>.t</code> files and sees that it is Bash, and runs Bash instead. Here's an <a href="https://github.com/ingydotnet/inline-module-pm/blob/master/test/devel/generate-stub.t">example test file</a>. As you can see it is very simple and easy to understand. If you squint your eyes, it almost looks like Perl!</p> | ||
|
||
<h2>Next Steps</h2> | ||
|
||
<p>We should be wrapping this Grant project up soon. We still need to:</p> | ||
|
||
<ul> | ||
<li>Add Module::Build support</li> | ||
<li>Update all the pluins</li> | ||
<li>Update the docs</li> | ||
<li>Migrate a few real XS modules to Inline::Module</li> | ||
</ul> | ||
|
||
<p>Stay tuned. Inline Modules are becoming a reality!</p> | ||
</div> | ||
</div><!-- /.blog-main --> | ||
<div class="col-sm-3 col-sm-offset-1 blog-sidebar"> | ||
<div class="sidebar-module sidebar-module-inset"> | ||
<h4>About</h4> | ||
<p>This site has the latest info about the progress of the TPF grant for Inline.pm</p> | ||
</div> | ||
<div class="sidebar-module"> | ||
<!-- | ||
<h4>Archives</h4> | ||
<ol class="list-unstyled"> | ||
<li><a href="#">October 2014</a></li> | ||
</ol> | ||
</div> | ||
--> | ||
<!-- | ||
<div class="sidebar-module"> | ||
<h4>Elsewhere</h4> | ||
<ol class="list-unstyled"> | ||
<li><a href="#">GitHub</a></li> | ||
<li><a href="#">Twitter</a></li> | ||
<li><a href="#">Facebook</a></li> | ||
</ol> | ||
</div> | ||
--> | ||
</div><!-- /.blog-sidebar --> | ||
|
||
</div><!-- /.row --> | ||
</div><!-- /.container --> | ||
<!-- | ||
<div class="blog-footer"> | ||
<p>Blog template built for <a href="http://getbootstrap.com/">Bootstrap</a> by <a href="https://twitter.com/mdo">@mdo</a>.</p> | ||
<p> | ||
<a href="#">Back to top</a> | ||
</p> | ||
</div> | ||
--> | ||
<!-- Bootstrap core JavaScript | ||
================================================== --> | ||
<!-- Placed at the end of the document so the pages load faster --> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | ||
<script src="http://getbootstrap.com/dist/js/bootstrap.min.js"></script> | ||
|
||
<!-- Cog JS | ||
================================================== --> | ||
<script src="js/all.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.