<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Florian Helmberger's blog &#187; Perl</title>
	<atom:link href="http://www.laudatio.com/wordpress/category/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.laudatio.com/wordpress</link>
	<description>laudatio.com</description>
	<lastBuildDate>Mon, 23 Nov 2009 21:07:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Note to self about class methods</title>
		<link>http://www.laudatio.com/wordpress/2008/11/05/note-to-self-about-class-methods/</link>
		<comments>http://www.laudatio.com/wordpress/2008/11/05/note-to-self-about-class-methods/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 19:39:49 +0000</pubDate>
		<dc:creator>fh</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Digest::MD5]]></category>
		<category><![CDATA[Digest::SHA1]]></category>

		<guid isPermaLink="false">http://www.laudatio.com/wordpress/?p=75</guid>
		<description><![CDATA[Don't use them unless you are knowing what you are doing. I recently ran into something strange and was quite busy fixing the problem using much database mojo.
For the calculation of some MD5 sums I was using Digest::MD5. And for some reason I used it this way:
perl -MDigest::MD5 -le 'print Digest::MD5-&#62;md5_hex(&#34;foo&#34;)'
3200a4cda22a4a935412da8113b4139b
Looks good doesn't it? But [...]]]></description>
			<content:encoded><![CDATA[<p>Don't use them unless you are knowing what you are doing. I recently ran into something strange and was quite busy fixing the problem using much database mojo.</p>
<p>For the calculation of some MD5 sums I was using <a href="http://search.cpan.org/dist/Digest-MD5/">Digest::MD5</a>. And for some reason I used it this way:</p>
<pre class="bash"><span style="color: #c20cb9; font-weight: bold;">perl</span> -MDigest::MD5 -le <span style="color: #ff0000;">'print Digest::MD5-&gt;md5_hex(&quot;foo&quot;)'</span>
3200a4cda22a4a935412da8113b4139b</pre>
<p>Looks good doesn't it? But the MD5 digest is incorrect. Just try it yourself and enter 'foo' in any given web MD5 generator out there.</p>
<p>The right way to use Digest::MD5 (and <a href="http://search.cpan.org/~gaas/Digest-SHA1-2.11/SHA1.pm">Digest::SHA1</a> too) would be</p>
<pre class="bash"><span style="color: #c20cb9; font-weight: bold;">perl</span> -M<span style="color: #ff0000;">'Digest::MD5 &quot;md5_hex&quot;'</span> -le <span style="color: #ff0000;">'print md5_hex(&quot;foo&quot;)'</span>
acbd18db4cc2f85cedef654fccc4a4d8</pre>
<p>Okay, my fault. But this annoys me a bit:</p>
<pre class="bash"><span style="color: #c20cb9; font-weight: bold;">perl</span> -<span style="color: #c20cb9; font-weight: bold;">w</span> -MDigest::MD5 -le <span style="color: #ff0000;">'print Digest::MD5-&gt;md5_hex(&quot;foo&quot;)'</span>
&amp;Digest::MD5::md5_hex <span style="color: #000000; font-weight: bold;">function</span> probably called <span style="color: #c20cb9; font-weight: bold;">as</span> class method at -e line <span style="color: #000000;">1</span>.
3200a4cda22a4a935412da8113b4139b
fh$ <span style="color: #c20cb9; font-weight: bold;">perl</span> -Mstrict -Mwarnings -MDigest::MD5 -le \
  <span style="color: #ff0000;">'print Digest::MD5-&gt;md5_hex(&quot;foo&quot;)'</span>
3200a4cda22a4a935412da8113b4139b</pre>
<p>To be honest I have no idea, why <code>-w</code> produces a warning (which is a good thing) and <code>use warning</code> doesn't.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.laudatio.com/wordpress/2008/11/05/note-to-self-about-class-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
