Skip to content

Commit

Permalink
New report #7
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Dec 7, 2014
1 parent f2d32d4 commit 7914562
Show file tree
Hide file tree
Showing 9 changed files with 562 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -13,7 +13,7 @@ COG_ROOT := $(BRANCHDIR)/cog
BUILD_ROOT := $(BRANCHDIR)/build

# XXX Temporary hack to make module links work.
SWIM_LINK_FORMAT_HACK := 1
# SWIM_LINK_FORMAT_HACK := 1

include pkg/nodes.mk

Expand Down
107 changes: 77 additions & 30 deletions index.html
Expand Up @@ -39,6 +39,83 @@ <h1 class="blog-title">The TPF Inline Grant Info Site</h1>
<div class="row">
<div class="col-sm-8 blog-main">
<div class="blog-post">
<h2 class="blog-post-title"><a href="node/dgq3.html">Inline Grant Weekly Report #7</a></h2>
<p class="blog-post-meta">
December 6, 2014 by
<a href="page/ingy-and-david-bio.html">Ingy and David</a>
</p>
<p>This week made great strides for Inline::Module. Last week, we talked about <strong>auto-stubbing</strong>. That&#39;s the automatic generation of little &quot;stub&quot; 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 =&gt; &#39;... C code here ...&#39;;
</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 &quot;stub&quot; 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&#39;d call that <em>Explicit Stubbing</em>. <strong>DON&#39;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&#39;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&#39;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: &quot;run this command, in this environment and see if these files exist, etc&quot;, 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&#39;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>
<hr />
<div class="blog-post">
<h2 class="blog-post-title"><a href="node/n6sv.html">Inline Grant Weekly Report #6</a></h2>
<p class="blog-post-meta">
December 1, 2014 by
Expand Down Expand Up @@ -447,36 +524,6 @@ <h2 class="blog-post-title"><a href="node/se9g.html">Inline Grant Weekly Report

<p>There&#39;s no need to run <code>make</code> to build the C/C++/XS in <code>blib</code> and then add <code>-b</code> to the <code>prove</code> flags, because this is <strong>Inline</strong>!</p>
</div>
<hr />
<div class="blog-post">
<h2 class="blog-post-title"><a href="node/y5yq.html">Inline Grant Accepted</a></h2>
<p class="blog-post-meta">
October 20, 2014 by
<a href="page/ingy-and-david-bio.html">Ingy and David</a>
</p>
<p>(or <strong>How I Learned to Stop Worrying and Love The Perl</strong>)</p>

<p>Last week I returned from 3 weeks of adventure in Berlin and Netherland. Funny story… the night I arrived at Liz and Wendy&#39;s place, I was made aware of 2 things:</p>

<ul>
<li>Liz is on the TPF grant board</li>
<li>She had a surprise for me, but couldn&#39;t tell me until midnight :)</li>
</ul>

<p>Spoiler: <a href="http://news.perlfoundation.org/2014/09/grant-proposal-inlinecpp-modul.html">The Inline Grant</a> was approved!</p>

<p>The following evening, I attended the amsterdamx.pm (expats) at Booking.com++ HQ, and upon entering the meeting room, was asked by SawyerX if I could give a talk since ribasushi was stuck in traffic. Huh? WTF? Definitely! :) In the kind of coincidence that only happens regularly in the world of Perl, Karen Pauley happened to be there as well, not to mention Stevan, Jarrko and Dan Kogai! I rambled on about a dozen things that were currently loaded into ingy-RAM, but held off on talking about the grant as it hadn&#39;t been made public just yet.</p>

<p>7 days to the minute later I gave a talk at amsterdam.pm and the main subject was the Inline grant. Instead of a talk, I gave a &quot;listen&quot;! I asked everyone there how they would go about actually implementing the grant solution. I got a lot of ideas, and since then I think I&#39;ve figured it out. Stay tuned…</p>

<h2>Welcome to the Inline Grant blog!</h2>

<p>I think this is the first TPF grant to be given to a pair of pair programmers! David and I want to make things as open as we can, so we plan to give weekly updates in addition to the TPF monthly status updates.</p>

<p>Today (October 20th) marks the start of work in earnest on the grant. The delay is due to my unexpected but most fruitful trip to Europe. I&#39;m dejetlagged and ready to hack! David has also just finished a lovely family vacation (to Zion and Bryce National Parks (YAPC::15 attendees with wheels should take note!)).</p>

<p>We really want to thank the community for this opportunity to make Perl better!</p>
</div>
<hr />
</div><!-- /.blog-main -->
<div class="col-sm-3 col-sm-offset-1 blog-sidebar">
Expand Down
20 changes: 18 additions & 2 deletions js/all.js
Expand Up @@ -6,7 +6,7 @@ compiled Jemplate templates.
AUTHOR - Ingy döt Net <ingy@cpan.org>
Copyright 2006-2014 Ingy döt Net.
Copyright 2006,2008 Ingy döt Net.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
Expand Down Expand Up @@ -1907,7 +1907,7 @@ Jemplate.JSON = {
Template Toolkit. Any changes made to this file will be lost the next
time the templates are compiled.
Copyright 2006-2014 - Ingy döt Net - All rights reserved.
Copyright 2006-2008 - Ingy döt Net - All rights reserved.
*/

var Jemplate;
Expand All @@ -1934,6 +1934,22 @@ output += '<p>Name: Inline Grant Weekly Report #5 Type: post Date: November 22,
return output;
}

Jemplate.templateMap['dgq3.html'] = function(context) {
if (! context) throw('Jemplate function called without context\n');
var stash = context.stash;
var output = '';

try {
output += '<p>Name: Inline Grant Weekly Report #7 Type: post Date: December 6, 2014</p>\n\n<p>This week made great strides for Inline::Module. Last week, we talked about <strong>auto-stubbing</strong>. That&#39;s the automatic generation of little &quot;stub&quot; modules that proxy invocations of <a href="https://metacpan.org/pod/Inline">Inline</a>, so we can write simple code like this:</p>\n\n<pre><code>package My::Module;\nuse My::Module::Inline C =&gt; &#39;... C code here ...&#39;;\n</code></pre>\n\n<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>\n\n<p>This week auto-stubbing is a reality and it works well! In fact, it turns out that the &quot;stub&quot; module never even needs to exist on disk. Read on!</p>\n\n<h2>Latest Developments</h2>\n\n<p>We got rid of the <code>bin</code> script: <code>perl-inline-module</code> that was used to generate stubs, like this:</p>\n\n<pre><code>perl-inline-module generate Acme::Math::XS::Inline\n</code></pre>\n\n<p>We replaced it with a simple one-liner:</p>\n\n<pre><code>perl -MInline::Module=makestub,Acme::Math::XS::Inline\n</code></pre>\n\n<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>\n\n<pre><code>perl -MInline::Module=makestub,Acme::Math::XS::Inline,blib\n</code></pre>\n\n<h2>Auto-Stubbing</h2>\n\n<p>I&#39;d call that <em>Explicit Stubbing</em>. <strong>DON&#39;T DO THAT!</strong></p>\n\n<p>Well you can if you want but the cool new way to use Inline::Module is with <strong>Auto</strong> Stubbing. Here&#39;s how you do it:</p>\n\n<pre><code>export PERL5OPT=-MInline::Module=autostub,Acme::Math::XS::Inline\n</code></pre>\n\n<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>\n\n<p>You can also auto-stub to disk if you want:</p>\n\n<pre><code>export PERL5OPT=-MInline::Module=autostub,Acme::Math::XS::Inline,blib\n</code></pre>\n\n<p>but why would you want to? With the in-memory stubs, you don&#39;t need to worry about an extra file laying around.</p>\n\n<h2><code>blib/Inline/</code></h2>\n\n<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>\n\n<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>\n\n<h2>Testing</h2>\n\n<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: &quot;run this command, in this environment and see if these files exist, etc&quot;, Bash tests make sense.</p>\n\n<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&#39;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>\n\n<h2>Next Steps</h2>\n\n<p>We should be wrapping this Grant project up soon. We still need to:</p>\n\n<ul>\n<li>Add Module::Build support</li>\n<li>Update all the pluins</li>\n<li>Update the docs</li>\n<li>Migrate a few real XS modules to Inline::Module</li>\n</ul>\n\n<p>Stay tuned. Inline Modules are becoming a reality!</p>\n';
}
catch(e) {
var error = context.set_error(e, output);
throw(error);
}

return output;
}

Jemplate.templateMap['ecf6.html'] = function(context) {
if (! context) throw('Jemplate function called without context\n');
var stash = context.stash;
Expand Down
8 changes: 8 additions & 0 deletions js/all.json
@@ -1,6 +1,7 @@
{
"heading" : "Up to date information on The Perl Foundation's 2014 grant for Inline.pm.",
"node_order" : [
"dgq3",
"n6sv",
"cc8p",
"mh4x",
Expand All @@ -12,6 +13,13 @@
"y5yq"
],
"nodes" : [
{
"cogid" : "dgq3",
"date" : "December 6, 2014",
"link" : "inline-grant-weekly-report-7",
"title" : "Inline Grant Weekly Report #7",
"type" : "post"
},
{
"cogid" : "n6sv",
"date" : "December 1, 2014",
Expand Down
159 changes: 159 additions & 0 deletions node/dgq3.html
@@ -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&#39;s the automatic generation of little &quot;stub&quot; 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 =&gt; &#39;... C code here ...&#39;;
</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 &quot;stub&quot; 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&#39;d call that <em>Explicit Stubbing</em>. <strong>DON&#39;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&#39;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&#39;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: &quot;run this command, in this environment and see if these files exist, etc&quot;, 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&#39;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>

0 comments on commit 7914562

Please sign in to comment.