<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Joe McMahon</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/joe_mcmahon1/" />
    <link rel="self" type="application/atom+xml" href="http://blogs.perl.org/users/joe_mcmahon1/atom.xml" />
    <id>tag:blogs.perl.org,2009-11-03:/users/joe_mcmahon1//1362</id>
    <updated>2013-04-04T01:33:41Z</updated>
    <subtitle>A blog about the Perl programming language</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.38</generator>

<entry>
    <title>What exactly is going on at Perlmonks?</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/joe_mcmahon1/2013/04/what-exactly-is-going-on-at-perlmonks.html" />
    <id>tag:blogs.perl.org,2013:/users/joe_mcmahon1//1362.4495</id>

    <published>2013-04-04T00:13:05Z</published>
    <updated>2013-04-04T01:33:41Z</updated>

    <summary>I went back to Perlmonks for the first time in quite some time, and was greeted with by a poll titled &quot;How many man-hours would you estimate you have invested in learning Perl?&quot; - okay, could have been hours, not...</summary>
    <author>
        <name>Joe McMahon</name>
        <uri>https://pemungkah.com</uri>
    </author>
    
    <category term="feminism" label="feminism" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perlmonks" label="perlmonks" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="stereoypes" label="stereoypes" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="whatthehellwereyouthinking" label="what the hell were you thinking" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/joe_mcmahon1/">
        <![CDATA[<p>I went back to Perlmonks for the first time in quite some time, and was greeted with by a poll titled "How many man-hours would you estimate you have invested in learning Perl?" - okay, could have been hours, not enough to make a big deal of, I'm trying not to make every interaction on the site about male privilege...aw, dammit:</p>

<blockquote>None - I refuse to acknowledge the term man hours, you patriarchical pig. But I have many person-hours. And let me tell you...</blockquote>

<p>Oh, <strong>COME ON</strong>.</p>

<p>This is going from <a href="http://en.wikipedia.org/wiki/Microaggression">microaggression</a> ("man-hours") straight into pure jackassery. <a href="http://geekfeminism.wikia.com/wiki/Straw-feminist">Straw feminists</a> are just as much a stereotype as any other. Making jokes that require me to be complicit with a stereotyped view of the world really gets up my nose.</p>

<p>It sends the message that "we here at Perlmonks think this kind of thing is really funny and we don't care what you think. We especially don't care if you're the kind of person we're enjoying making fun of."</p>

<p>What happened to trying to be inclusive? Did you guys (and I <em>specifically</em> mean the men) not watch <a href="https://www.youtube.com/watch?v=TAOxGjNbp_Y">Schwern's keynote</a>? (If you didn't watch it, there's the link - you have no excuse.)</p>

<p>Did I miss the memo where Perlmonks was officially declared a boys-only club, where he Internet equivalent of farting and catcalls is the dominant paradigm? Or is this just an attempt to claim of "we don't have to be civilized if we don't want to" to see if anyone will notice? </p>

<p>Yes, <em>do</em> let me tell you: I noticed. And I think it's ugly and disgusting.</p>

<p>Feminism does not require you to be female. <br />
</p>]]>
        <![CDATA[<blockquote></blockquote>]]>
    </content>
</entry>

<entry>
    <title>&quot;White knight&quot;, a meditation</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/joe_mcmahon1/2012/09/white-knight-a-meditation.html" />
    <id>tag:blogs.perl.org,2012:/users/joe_mcmahon1//1362.3793</id>

    <published>2012-09-05T21:24:17Z</published>
    <updated>2012-09-06T17:16:15Z</updated>

    <summary>If you think &quot;white knight&quot; is a crap term, a convenient argument-by-dismissal tactic, then you probably already know all this, but there may be some useful ideas for the next time someone attempts to spring this on you. On the...</summary>
    <author>
        <name>Joe McMahon</name>
        <uri>https://pemungkah.com</uri>
    </author>
    
    <category term="cpan" label="CPAN" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="whiteknight" label="white knight" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/joe_mcmahon1/">
        <![CDATA[<p>If you think "white knight" is a crap term, a convenient argument-by-dismissal tactic, then you probably already know all this, but there may be some useful ideas for the next time someone attempts to spring this on you.  </p>

<p>On the other hand, if you're one of those who think it's the scored-the-touchdown-high-five-we're-done-here way out of any situation where you've said or done something crappy and then been called on it, you're probably not going to read this anyway, but I shall go ahead and write it so you will have to waste energy making up increasingly vituperative denials which I will pointedly ignore.</p>

<p>I have heard this term used both explicitly and implicitly multiple times recently because I decided to speak out on something that I didn't like and that mattered to me, despite the fact that it wasn't about me. "White knight" supposedly means that I spoke out solely to impress somebody with how noble and great a person I am, and that I otherwise wouldn't have made the effort, and that it was all about what I could get out of it.</p>

<p>First: if you really think people only do things to for their own benefit, like the Grinch, your heart is several sizes too small.</p>

<p>Second, I have no need to do this, thanks - I've actually learned social skills and things, and can actually manage to communicate with people other than by waving metaphorical "SEE I'M A NICE GUY OH GOD I'M SO ALONE" signal flags across the Internet. People who know me personally know I do things because I'm genuinely decent, as opposed to someone who's "nice" and expecting a payback. That is what is known as "manipulation".</p>

<p>Third, despite the fact that I am indeed heterosexual and male, I have no desire to have sex with random people simply because they are female and breathing. </p>

<p>Last, nice try at making it about me rather than the stunningly ill-bred, bad-mannered, and probably stupid thing you just said.</p>

<p>Moving on, let's talk about Perl and CPAN.</p>

<p>Perl exists because Larry Wall decided that this tool he put together for his own purposes would help people - would "make the easy things easy and the hard things possible." He wrote it, and gave it away for free. Many other people found it, used it, thought it good, and offered their own time and effort to make it better, with the only thing they got directly being recognition. Perl and the Perl Porters made people happier.</p>

<p>CPAN exists because many people, most of whom don't know each other at all, decided to give away something they made to anyone who wanted it, without regard for reward. the only reason it happened at all was because one person, Jarkko Hietianiemi, created CPAN itself and said, "Here's a gift. It was needed, so I made it. I want nothing for it. Please use it if you want it." (Note: this is not a quote, but a paraphrase I've constructed out of seeing what Jarkko has done over the years I've known him and known of him. Yes, I admire the hell out of him and think he's a mensch. Fanboy moment over. Let's forge onward.)</p>

<p>Many others built upon this gift, extending the network and adding new modules to it, to the point that Perl is not so much a language but an incredible collection of software that happens to have one language that can run it.</p>

<p>The participants all wrote software, or set up nodes in the network, because their hearts (or ethics, as you prefer) told them "this is the right, good, and joyful thing for me to do". It was not free; it cost them each time and effort; but year by year it created a great and glorious thing. It made Perl into a great force for making things happen. It made them happy.</p>

<p>So, we have people voluntarily doing something for the good of others they don't even know personally. Doing it because it was, in their eyes, the right thing to do. Doing it for nothing other than perhaps the admiration of others, though that wasn't guaranteed. Sometimes they even did it to help others - for people who didn't even know they'd done it. Doing it to increase joy, whether they knew it or not. It made them happy.</p>

<p>Does this not make them all "white knights"? Shall we sneer at them all now because we all "know" that they wrote all that software to impress someone? </p>

<p>Does this get across how incredibly small-souled, short-sighted, and just plain dumb this is?</p>

<p>To reduce it to its most basic: actions which are termed "white knighting" are those meant to help make more joy by pointing out that trying to reduce joy is wrong. Joy, like software, is not a zero-sum game. You don't have to make someone else less happy to be more happy. You don't make Perl better by talking about how horrible Python is. They both stay the same. You're just substituting schadenfreude for true joy.</p>

<p>Trying to remove something from the world that would decrease someone else's joy by saying, "that's not right," is a good thing to do. Even if it doesn't work, you've still said, "Not everyone thinks you should be less joyful. Someone else in the group this came from thinks it's wrong." That won't undo the nasty thing, but it might help take the sting away a little.</p>

<p>So the white knight is the CPAN author of the heart.</p>

<p>I believe in creating joy however I can. I've released a fair amount of free software. I also believe in trying to create joy through words and the truth, and not tolerating things that are wrong. I can't write every module on this metaphorical CPAN, but I can try to write the ones that apply to the things I do.</p>

<p>Please, do call me a white knight. From now on I think I'll say, "Hey, thanks for noticing! <a href="http://tinybuddha.com/blog/20-ways-to-give-without-expectations/">Like to help?</a>"</p>]]>
        
    </content>
</entry>

<entry>
    <title>Social diagnostics</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/joe_mcmahon1/2012/09/social-diagnostics.html" />
    <id>tag:blogs.perl.org,2012:/users/joe_mcmahon1//1362.3786</id>

    <published>2012-09-04T18:20:37Z</published>
    <updated>2012-09-04T19:13:48Z</updated>

    <summary>First, a huge thank-you to all the folks who have commented on my post (whether they agree with it or not) and who have followed up on Perlmonks to say &quot;well, I think this might be correct&quot; - or not,...</summary>
    <author>
        <name>Joe McMahon</name>
        <uri>https://pemungkah.com</uri>
    </author>
    
    <category term="diagnostics" label="diagnostics" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="gender" label="gender" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="warnings" label="warnings" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/joe_mcmahon1/">
        <![CDATA[<p>First, a huge thank-you to all the folks who have commented on <a href="http://blogs.perl.org/users/joe_mcmahon1/2012/08/why-im-considering-dropping-perlmonks.html">my post</a> (whether they agree with it or not) and who have followed up on Perlmonks to say "well, I think this might be correct" - or not, as long as it's not about me, but about the topic. I think it's important to talk about what happened, even if no one's mind is directly changed.</p>

<p>I'm afraid that at least one of the participants feels singled out, which was not my intention. I am truly sorry that this person feels attacked. This was totally not what I wanted or was trying to do.</p>

<p>To try to clarify this social thing for folks who normally ignore it or don't see the point, I'm going to invoke an extended metaphor here.</p>

<p>All I wanted to do, to go all technical about it, was to issue a social diagnostic: a warning, not an error message, that said "I think Perkmonks needs to be inclusive, and sexualizing software doesn't do that". </p>

<p>At no time did I want to say or imply <i>anyone</i> was a bad person, nor did I want anyone <i>else</i> to say so (If you did, please follow along here to see what I was really after). Nor did I want to say, "this social interaction, large and small-scale, cannot proceed unless this changes."</p>

<p>That's not what warnings are for. They are meant to inform - to communicate that there were perhaps unintended consequences. They are not telling you "you are a terrible, terrible programmer and should now walk away and start digging ditches". They are meant to say, "you've made a choice that may have consequences other than you planned, and you should consider correcting this," and "when you run this, it may not do exactly what you intend it to do."</p>

<p>I believe, that originally, the impulse was to share something that brought lightness to the original poster's day. It ran on his internal mental architecture and made him smile or laugh. Running on his internal mental processor, there was no diagnostic that said "this may have unintended consequences on other architectures". The idea is to internalize that other architectures exist, and that you may need to adjust code released ostensibly to run on all of them.</p>

<p>It's the difference between getting an OS-X-only diagnostic and saying, "oh, right, I should change that so it runs properly there" and saying "well, you ought to be running a decent OS and then you wouldn't have this problem". Or even saying, "I really don't have a way to make that work on a Mac. I should consider whether that feature should go in to the main release - or if I should release it in a way that Mac users know it's not for them".</p>

<p>We have been guilty, to a certain extent, of dismissing Windows in the Perl community. Having that attitude doesn't make Windows folks say, "my heavens, you're right - I have seen the light and shall abandon this OS and the years of investment in it right away!" Instead, it makes them say, "man, what a bunch of prejudiced, blinkered idiots! Why am I bothering with this?"</p>

<p>A social diagnostic is meant to provide information. You can decide that it's not worth bothering with and ignore it, or take it to heart and try to make a change. Attacking the source of the diagnostic is counter-productive. If you get a warning that you've reused a 'my' variable, you don't say, "well, this verion of Perl is complete garbage, because I want to do that, and therefore it should change to allow me to do so."</p>

<p>You either tell the compiler "I know that I'm doing this and I want to; please turn off that diagnostic here", or you look at the code and say, "Hm, okay, I can change that".</p>

<p>You don't, however, complain "the Perl interpreter isn't accepting and running this perfectly good Python code; there must be something wrong with the compiler that it would tell me that it thinks my program shouldn't run here". You can either fix it so the Perl interpreter can run it, or you go use the Python compiler for that particular bit of code. (If that was too esoteric a parallel: there are places where posting that cartoon wouldn't have offended anyone in that place, and if you want to hang out in those places, I'm not going to say you shouldn't. I may think so, but I don't have the right to tell you where you can go and who you should hang out with. I will tell you if you do something that <i>i</i> dislike; it is up to you to decide if you want to not do it where I can see it - and if you want to keep doing it at all once I've mentioned it.)</p>

<p>There has been quite a bit of black-and-whiting in this discussion: "oh, you obviously think you're perfect and that I'm terrible". As I said on Perlmonks, I screw social things up <i>all the time</i> - even with close friends. Maybe especially with close friends. </p>

<p>I badly hurt a close friend this weekend because I didn't think it through before I said something (not in a gender-related discussion, though). I am totally <i>not</i> saying "I know better about what all women think than you do." Women whom I know and admire - and who are <i>very</i> accepting people, and whose ability to think in a straight line I <i>deeply</i> respect - have said to me, "someone posted this? <i>Seriously?</i>". So I transmit the diagnostic because I'm there, and <a href="http://whatever.scalzi.com/2012/05/15/straight-white-male-the-lowest-difficulty-setting-there-is/">playing on the lowest difficulty setting</a> and am therefore sufficiently sure of myself in the community that a bad reaction isn't going to make me think, "jeez, do I really belong here at all?".</p>

<p>Again, I'm sorry it got and felt personal. It was never intended to be, beyond saying, "here's a place where by saying, 'whoops, I guess that wasn't as appropriate as I thought', you personally can do something to help Perl's image as a boy's club, and I would admire you a lot for doing so, though I admit I'll be disappointed if you don't."</p>]]>
        
    </content>
</entry>

<entry>
    <title>Why I&apos;m considering dropping Perlmonks</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/joe_mcmahon1/2012/08/why-im-considering-dropping-perlmonks.html" />
    <id>tag:blogs.perl.org,2012:/users/joe_mcmahon1//1362.3760</id>

    <published>2012-08-28T18:38:28Z</published>
    <updated>2012-08-29T09:23:06Z</updated>

    <summary>A couple days ago, a comic strip was posted to Perlmonks that really got up my nose. For those of you who don&#8217;t want to bother linking through, the strip compares Perl with Moose to Perl having a &#8220;boob job&#8221;,...</summary>
    <author>
        <name>Joe McMahon</name>
        <uri>https://pemungkah.com</uri>
    </author>
    
    <category term="diversity" label="diversity" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perlmonks" label="perlmonks" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="schwernkeynote" label="Schwern Keynote" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/joe_mcmahon1/">
        <![CDATA[<p>A couple days ago, a <a href="http://stripgenerator.com/strip/597425/moose-moore-or-mouse/">comic strip</a> was posted to Perlmonks that really got up my nose. For those of you who don&#8217;t want to bother linking through, the strip compares Perl with Moose to Perl having a &#8220;boob job&#8221;, then wanders off into creepy territory because sexualization and creepiness are really, really funny, right?</p>

<p>This bothers me, as it&#8217;s not friendly to the women in our community – and I said so. You can <a href="http://perlmonks.org/?node_id=989879">read</a> the response I&#8217;ve gotten so far.  They&#8217;re all pretty much ignoring the fact that sexualizing a computer program (with the added implication of large breasts being equivalent to personal value) is exactly the kind of thing that makes women feel unwelcome by focusing on &#8220;well, &#8216;boob job&#8217; is a perfectly fine term&#8221; and &#8220;I bet you do feel uncomfortable imagining you&#8217;re female!&#8221;. (By the way, no, I don&#8217;t. This is that funny thing called &#8220;empathy&#8221;.)</p>

<p>I&#8217;ve mentioned the atmosphere of disrespect toward women previously in other threads and gotten solidly downvoted for it – and had to repeatedly defend the idea that maybe everyone ought to consider whether the boys&#8217; club atmosphere isn&#8217;t something we ought to change.</p>

<p>I linked <a href="http://www.youtube.com/watch?v=TAOxGjNbp_Y">Schwern&#8217;s YAPC keynote</a> – and I get the impression that the audience is mostly made up of the people who &#8220;<a href="http://blog.nu42.com/2012/06/dont-box-me-in-yapcna-2012-impressions.html">thought it was a downer</a>&#8221;. (It&#8217;s good to see that there are <a href="http://blog.xzion.net/2012/06/18/my-first-yapc/">members</a> <a href="http://shadow.cat/blog/matt-s-trout/community-diary-2012-06-23/">of the</a> <a href="http://blogs.perl.org/users/sawyer_x/2012/06/facing-the-unlikely-but-perhaps-possible-emotion.html">Perl community</a> <a href="http://www.modernperlbooks.com/mt/2012/06/promoting-perl-to-dissimilar-users.html">who don&#8217;t think this</a>.)</p>

<p>This depresses me. Perlmonks can be tremendously valuable, but it seems to me that the loudest voices are not listening to things they really need to hear. It&#8217;s not all about the tech; it&#8217;s about helping people, whoever they are, get more out of Perl.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>git svn vs. svn2git (vs. &quot;svn2git&quot;)</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/joe_mcmahon1/2012/07/git-svn-vs-svn2git-vs-svn2git.html" />
    <id>tag:blogs.perl.org,2012:/users/joe_mcmahon1//1362.3518</id>

    <published>2012-07-11T20:11:38Z</published>
    <updated>2012-07-11T20:20:57Z</updated>

    <summary>If you&apos;re ever in the position of needing to convert a large (in our case around 32000 revisions) Subversion repository to a Git repository, you should know git svn is agonizingly slow, and falls over at regular intervals (apparently memory...</summary>
    <author>
        <name>Joe McMahon</name>
        <uri>https://pemungkah.com</uri>
    </author>
    
    <category term="git" label="git" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="kde" label="KDE" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ruby" label="Ruby" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="subversion" label="Subversion" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="svn2git" label="svn2git" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/joe_mcmahon1/">
        <![CDATA[<p>If you're ever in the position of needing to convert a large (in our case around 32000 revisions) Subversion repository to a Git repository, you should know<br />
<ul><br />
    <li>git svn is agonizingly slow, and falls over at regular intervals (apparently memory problems; symptom is "git svn died with signal 13")</li><br />
    <li>The KDE version of "git2svn" is written in C++, requires that QT4 be installed (so you have "qmake"), and requires a local copy of the SVN repository. If you have it, it is apparently blindingly fast - in my case I didn't have direct access to download the whole SVN repository.<br />
</ul><br />
So for my conversion I used the "svn2git" Ruby gem. It works very well indeed, and is screamingly fast. My current import has been running for 12 hours and is about halfway done - this may seem slow, but the "git svn" version, even wrapped with a Perl program to restart it when it fell over, ran for over <em>three weeks</em> before hitting a situation where it couldn't continue, with the import imcomplete.<br />
<p><br />
I'll update the post once the import completes - or if it doesn't!</p>]]>
        
    </content>
</entry>

<entry>
    <title>I Want My Objective-C</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/joe_mcmahon1/2012/06/i-want-my-objective-c.html" />
    <id>tag:blogs.perl.org,2012:/users/joe_mcmahon1//1362.3438</id>

    <published>2012-06-28T05:14:40Z</published>
    <updated>2012-06-28T05:47:57Z</updated>

    <summary>The other day, as they idea of the defined-dereference operator (~&gt; is the favorite at the moment), I proposed the idea of implementing a pragma that changed what Perl does when it&apos;s faced with a dereference of, or a message...</summary>
    <author>
        <name>Joe McMahon</name>
        <uri>https://pemungkah.com</uri>
    </author>
    
    <category term="definedor" label="defined-or" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="objectivec" label="Objective-C" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="undef" label="undef" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/joe_mcmahon1/">
        <![CDATA[<p>The other day, as they idea of the defined-dereference operator (~> is the favorite at the moment), I proposed the idea of implementing a pragma that changed what Perl does when it's faced with a dereference of, or a message sent to, undef. Right now, of course, it dies.</p>

<p>This bit me hard this evening as we put up some new code; I have a Mason template that calls a series of methods to get a particular piece of status information to be shown to the user. I had bullet proofed it, or so I thought.<br />
<pre><br />
my $foothing = $current_object->foo;<br />
if (defined $foothing) {<br />
    my @barthings = $foothing->bars();<br />
    if (defined $barthing[-1]) {<br />
        my $answer = $barthing->baz->status;<br />
    }<br />
}<br />
</pre><br />
Yep, <tt>$barthing->baz</tt> came back undef, and an error page instead of my actual page.<br />
<p><br />
Now, in the Objective-C world, <tt>nil</tt>, the Objective-C equivalent of <tt>undef</tt> has a special property: it accepts any message, and returns <tt>nil</tt>. So a lot of the boilerplate code (Get an object. Did I get it? Call a method. Did I get another object? Call a method. Did I...and so on) goes away - you don't need it at all. In the case of my code, if I had Objective-C-like undef-as-nil:<br />
<pre><br />
no failing 'deref';<br />
$answer = ($current_object->foo->bars)[-1]->baz->status // "not there";<br />
</pre><br />
Much less code, and I don't have to remember to check each step, unless I specifically want to do something if a given step is undef. If I do, I can use defined-or to set the value I want instead.</p>

<p>So now I have an excuse to work on this pragma - I actually <i>do</i> need it for work!</p>]]>
        
    </content>
</entry>

<entry>
    <title>MIME::Base64 and pearlclutching</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/joe_mcmahon1/2012/06/mimebase64-and-pearlclutching.html" />
    <id>tag:blogs.perl.org,2012:/users/joe_mcmahon1//1362.3392</id>

    <published>2012-06-14T18:23:13Z</published>
    <updated>2012-06-14T18:47:16Z</updated>

    <summary>I&apos;ve been working on WhiteHat&apos;s new sourcecode scanner, and one of the things we need to do is transmit snippets of source code around inside of XML. Since many XML parseres are notoriously sensitive to non-ASCII characters, even in CDATA,...</summary>
    <author>
        <name>Joe McMahon</name>
        <uri>https://pemungkah.com</uri>
    </author>
    
    <category term="base64jsonutf8interpolationtrick" label="base64 json utf-8 interpolation trick" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/joe_mcmahon1/">
        <![CDATA[<p>I've been working on <a href="https://www.whitehatsec.com/sentinel_services/sentinelSource-development.html">WhiteHat's new sourcecode scanner</a>, and one of the things we need to do is transmit snippets of source code around inside of XML. Since many XML parseres are notoriously sensitive to non-ASCII characters, even in CDATA, we decided that the simplest thing to do was Base64-encode them. This shouldn't be a problem, right?</p>

<p>Well, no. Turns out that <a href="http://search.cpan.org/~gaas/MIME-Base64-3.13/Base64.pm">MIME::Base64</a> is very picky itself about encoding things properly. If you hand it UTF-8, it screeches, "Characters with more than 8 bits?! Heavens!" and falls over. There's an incantation noted it its documentation that will let you handle it, but it didn't, at least for me, work all that dependably.</p>

<p>A little poking around turned up <a href="http://search.cpan.org/dist/Encode/lib/Encode/Encoder.pm">Encode::Encoder</a>, which works like a charm, and is very clean:<br />
<pre><br />
    use Encode::Encoder qw(encoder);<br />
    use Encode::Base64;</p>

<p>    my $encoded = encoder($unencoded)->base64;<br />
    my $decoded = encoder($encoded)->utf8('base64');<br />
</pre><br />
Pretty sweet. Only one thing to note, which is probably unique to my application: the result returned from an <tt>encoder()->base64()</tt> call (and the corresponding <tt>->utf8()</tt> call) is an object, not a string. If you're going to want to hand those off to the standard JSON module, be aware that it does not like this, and will die with the error <tt>encountered object 'Point=HASH(0x40017288)', but neither allow_blessed nor convert_blessed</tt>.</p>

<p>It's easy enough to get around this: just interpolate the output from the <tt>base64()</tt> method into a double-quoted string. This invokes the object's <tt>qq()</tt> overload and gives you a plain old string:<br />
<pre><br />
    $actual_string = qq($encoded);<br />
</pre><br />
If you want to do that all in one operation without a separate variable, you can use this trick to interpolate an evaluated expression into a string:<br />
<pre><br />
    $actual_string = qq<@{[encoder($unencoded)->base64]}>;<br />
</pre><br />
That's evaluate the expression, make it the only element in an anonymous array, then dereference that array in the string to force the value of the element to be interpolated.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Look, I Just Paid the Bill</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/joe_mcmahon1/2012/06/look-i-just-paid-the-bill.html" />
    <id>tag:blogs.perl.org,2012:/users/joe_mcmahon1//1362.3387</id>

    <published>2012-06-13T23:48:57Z</published>
    <updated>2012-06-13T23:59:01Z</updated>

    <summary>If you visit the Silicon Valley Perl Mongers Meetup site, you&apos;ll see that I&apos;m now listed as the organizer. This is not strictly true - Ian Kluft is still our primary organizer, but due to the fact that Meetup sends...</summary>
    <author>
        <name>Joe McMahon</name>
        <uri>https://pemungkah.com</uri>
    </author>
    
    <category term="svperlmeetup" label="SVPerl Meetup" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/joe_mcmahon1/">
        <![CDATA[<p>If you visit the <a href="http://www.meetup.com/SVPerl/">Silicon Valley Perl Mongers Meetup site</a>, you'll see that I'm now listed as the organizer. This is not strictly true - <a href="http://www.meetup.com/SVPerl/members/5676652/">Ian Kluft</a> is still our primary organizer, but due to the fact that Meetup sends out a metric buttload of mail - I have now witnessed this as organizer - he missed the "OMG SVPERL GONNA DIE" message that got sent, repeatedly, to all the SVPerl members when the Meetup bill was due in a week.</p>

<p>Everyone was getting nervous, so I jumped in and paid the bill, partly because everyone was getting nervous we hadn't heard from Ian, and partly because <a href="https://www.whitehatsec.com/">WhiteHat Security</a>, my current employer (who I love, and you should <a href="https://www.whitehatsec.com/abt/careers.html">come work here</a> if you are a good Perl programmer - heck, if you're a good Python or Ruby programmer, come and we'll teach you Perl) said they'd pick up the tab.</p>

<p>So, woo, I'm an organizer. I just like having an excuse to give talks!</p>]]>
        
    </content>
</entry>

</feed>
