<?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>The Effective Perler</title>
	<atom:link href="http://www.effectiveperlprogramming.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.effectiveperlprogramming.com</link>
	<description>Effective Perl Programming - write better, more idiomatic Perl</description>
	<lastBuildDate>Wed, 12 Jun 2013 21:15:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Experimental features now warn (reaching back to v5.10)</title>
		<link>http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/</link>
		<comments>http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/#comments</comments>
		<pubDate>Sat, 08 Jun 2013 22:34:46 +0000</pubDate>
		<dc:creator>brian d foy</dc:creator>
				<category><![CDATA[5.18]]></category>
		<category><![CDATA[new features]]></category>
		<category><![CDATA[warnings]]></category>

		<guid isPermaLink="false">http://www.effectiveperlprogramming.com/?p=1608</guid>
		<description><![CDATA[Perl 5.18 provides a new way to introduce experimental features in a program, augmenting the feature pragma that v5.10 added. This change marks certain broken v5.10 features as experimental with an eye toward possible removal from the language. Smart matching in v5.10 led to several broken and conflated features. The given used a lexical version [...]]]></description>
			<content:encoded><![CDATA[<p>Perl 5.18 provides a new way to introduce experimental features in a program, augmenting the <a href="http://perldoc.perl.org/feature.html">feature</a> pragma that v5.10 added. This change marks certain broken v5.10 features as experimental with an eye toward possible removal from the language.</p>
<p>Smart matching in v5.10 led to several broken and conflated features. The <code>given</code> used a lexical version of <code>$_</code>, which broke many other common uses of that variable inside the <code>given</code>, which I explain in <a href="http://www.effectiveperlprogramming.com/2011/05/use-for-instead-of-given/">Use for() instead of given()</a> and you can see in <a href="http://blogs.perl.org/users/komarov/2011/09/givenwhen-and-lexical.html">given/when and lexical $_ &#8230;</a>.</p>
<p>Under v5.18, when you use <code>given</code>, <code>when</code>, or <code>~~</code>, you get a warning, even if there is no smart match involved:</p>
<pre class="brush:perl">
# given_warning.pl
use v5.10; # earliest occurance of feature
for( 'Buster' ) {
	when( 1 == 1 ) { say "Hello" }
	}
</pre>
<p>These warnings might cause test suites to fail when people try to install modules on the new <code>perl</code>, like it does for <a href="http://www.cpantesters.org/cpan/report/da727304-bfdd-11e2-9f21-918710d45c6b">Unicode::Tussle</a>.</p>
<pre class="brush:plain">
% perl5.10.1 given_warning.pl
Hello
% perl5.18.0 given_warning.pl
when is experimental at given_warning.pl line 4.
Hello
</pre>
<p>Using the <a href="http://perldoc.perl.org/diagnostics.html">diagnostics</a> shows the sort of warning it is:</p>
<pre class="brush:plain">
% perl5.18.0 -Mdiagnostics given_warning.pl
when is experimental at -e line 1 (#1)
    (S experimental::smartmatch) when depends on smartmatch, which is
    experimental.  Additionally, it has several special cases that may
    not be immediately obvious, and their behavior may change or
    even be removed in any future release of perl.
    See the explanation under "Experimental Details on given and when"
    in perlsyn.

Hello
</pre>
<p>To get rid of this warning, you do the same thing you do with other warnings. Take the category of the warning and turn it off with <code>no</code> (<span class="item">Item 100: Use lexical warnings to selectively turn on or off complaints</span>):</p>
<pre class="brush:perl">
# given_warning.pl
use v5.10; # earliest occurance of feature
no warnings 'experimental::smartmatch';
for( 'Buster' ) {
	when( 1 == 1 ) { say "Hello" }
	}
</pre>
<p>The lexical <code>$_</code> is another broken fature that&#8217;s now marked as experimental.</p>
<pre class="brush:perl">
# lexical_.pl
use v5.10;

sub cat { my $_ }
</pre>
<p>Any use in v5.18 gives a warning:</p>
<pre class-"brush:plain">
% perl5.18.0 lexical_.pl
Use of my $_ is experimental at lexcial_.pl line 3.
</pre>
<p>The category is different:</p>
<pre class="brush:plain">
% perl5.18.0 -Mdiagnostics lexical_.pl
Use of my $_ is experimental at lexcial_.pl line 4 (#1)
    (S experimental::lexical_topic) Lexical $_ is an experimental
    feature and its behavior may change or even be removed in any
    future release of perl. See the explanation under "$_" in perlvar.
</pre>
<p>That takes care of the two retro features. Perl v5.18 introduces two new experimental features, set logic in character classes (for complete <A href="http://www.unicode.org/reports/tr18/tr18-5.1.html#Basic%20Unicode%20Support">Unicode Level 1 regular expression compliance</a>), and lexical subroutines, which I&#8217;ll cover in other items.</p>
<pre class="brush:perl">
# regex.pl
use v5.18;

print "Match" if 'foo' =~ /(?[ \p{Thai} &#038; \p{Digit} ])/;
</pre>
<p>Without turning off the warning, <code>perl</code> knows about the feature and points it out:</p>
<pre class="brush:plain">
% perl5.18.0 regex.pl
The regex_sets feature is experimental in regex; marked by <-- HERE in m/(?[ <-- HERE  \p{Thai} &#038; \p{Digit} ])/ at regex.pl line 4.
</pre>
<p>In this case, <a href="http://perldoc.perl.org/diagnostics.html">diagnostics</a> is not any help:</p>
<pre class="brush:plain">
% perl5.18.0 -Mdiagnostics regex.pl
The regex_sets feature is experimental in regex; marked by <-- HERE in m/(?[
        <-- HERE  \p{Thai} &#038; \p{Digit} ])/ at regex.pl line 3 (#1)
The regex_sets feature is experimental in regex; marked by <-- HERE in m/(?[ <-- HERE  \p{Thai} &#038; \p{Digit} ])/ at regex.pl line 3.
</pre>
<p>For lexical named subroutines, you have explicitly enable the feature but you then have to explicitly turn off its warnings.</p>
<pre class="brush:perl">
# lexical_sub.pl
use v5.18;
no warnings 'experimental::lexical_subs';
use feature "lexical_subs";

my sub foo { say "Hello" }
</pre>
<h2>Handling older perls</h2>
<p>In v5.18, that's all fine and good, but older versions don't understand those warnings categories and will stop your program.</p>
<pre class="brush:plain">
% perl5.10.1 -e 'no warnings qw(smartmatch)'
Unknown warnings category 'smartmatch' at -e line 1
BEGIN failed--compilation aborted at -e line 1.
</pre>
<p>Instead of using <a href="http://perldoc.perl.org/warnings.html">warnings</a>, you can use the non-core <a href="http://www.metacpan.org/module/experimental">experimental</a> module that handles that for you:</p>
<pre class="brush:perl">
use experimental qw(smartmatch);
</pre>
<p>For versions without that warning category, nothing happens. For versions with that feature, it turns off the warning.</p>
<h2>Summary</h2>
<p>This table summarizes the new experimental warnings categories and the features they affect.</p>
<p></p>
<div align="center">
<table>
<tr>
<th>Category</th>
<th>Features</th>
</tr>
<tr>
<td>experimental::smartmatch</td>
<td><code>given</code>, <code>when</code>, <code>~~</code></td>
</tr>
<tr>
<td>experimental::lexical_topic</td>
<td><code>my $_</code></td>
</tr>
<tr>
<td>experimental::regex_sets</td>
<td><code>(?[  ])</code></td>
</tr>
<tr>
<td>experimental::lexical_subs</td>
<td><code>my sub NAME {}</code>, <code>our sub NAME {}</code></td>
</tr>
</table>
</div>
<h2>Things to remember</h2>
<ul>
<li>Some v5.10 features now warn under v5.18
<li>Some new experimental features must be explicitly enabled
<li>Even explicitly enabled features still warn
<li>The <a href="http://www.metacpan.org/module/experimental">experimental</a> module is version safe
</ul>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Experimental+features+now+warn+%28reaching+back+to+v5.10%29+http://tinyurl.com/k33hjzg" title="Post to Twitter"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-twitter2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Experimental+features+now+warn+%28reaching+back+to+v5.10%29+http://tinyurl.com/k33hjzg" title="Post to Twitter"> </a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/&amp;title=Experimental+features+now+warn+%28reaching+back+to+v5.10%29" title="Post to Delicious"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/&amp;title=Experimental+features+now+warn+%28reaching+back+to+v5.10%29" title="Post to Delicious"> </a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/&amp;title=Experimental+features+now+warn+%28reaching+back+to+v5.10%29" title="Post to Digg"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/&amp;title=Experimental+features+now+warn+%28reaching+back+to+v5.10%29" title="Post to Digg"> </a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/&amp;t=Experimental+features+now+warn+%28reaching+back+to+v5.10%29" title="Post to Facebook"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-facebook.png" alt="Post to Facebook" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/&amp;t=Experimental+features+now+warn+%28reaching+back+to+v5.10%29" title="Post to Facebook"> </a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/&amp;title=Experimental+features+now+warn+%28reaching+back+to+v5.10%29" title="Post to Reddit"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/&amp;title=Experimental+features+now+warn+%28reaching+back+to+v5.10%29" title="Post to Reddit"> </a></p>]]></content:encoded>
			<wfw:commentRss>http://www.effectiveperlprogramming.com/2013/06/experimental-features-now-warn-reaching-back-to-v5-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl 5.18 new features</title>
		<link>http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/</link>
		<comments>http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/#comments</comments>
		<pubDate>Fri, 07 Jun 2013 17:20:53 +0000</pubDate>
		<dc:creator>brian d foy</dc:creator>
				<category><![CDATA[5.18]]></category>
		<category><![CDATA[new features]]></category>

		<guid isPermaLink="false">http://www.effectiveperlprogramming.com/?p=1599</guid>
		<description><![CDATA[Perl 5.18 is out and there are some major changes that you should know about before you upgrade. Most notably, some features from v5.10 are now marked experimental. If you use those features, you get warnings. Experimental features now warn (reaching back to v5.10) Perl regex character classes now have set operations Labels can be [...]]]></description>
			<content:encoded><![CDATA[<p>Perl 5.18 is out and there are some major changes that you should know about before you upgrade. Most notably, some features from v5.10 are now marked experimental. If you use those features, you get warnings.</p>
<p><br clear="all"/></p>
<ul>
<li><a href="http://www.effectiveperlprogramming.com/2013/06/experimental-f…-back-to-v5-10/">Experimental features now warn (reaching back to v5.10)</a>
<li>Perl regex character classes now have set operations
<li>Labels can be computed
<li><a href="http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/"><code class="regex">\s</code> now matches the vertical tab</a>
<li><code>given</code> now aliases <code>$_</code> like <code>foreach</code> does
<li><code>readline</code> now reads characters instead of octets
<li><code>CPANPLUS</code> and <code>Archive::Extract</code> are deprecated and marked for removal in v5.20.
<li>The <code>${^LAST_FH}</code> refers to the last filehandle.
</ul>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Perl+5.18+new+features+http://www.effectiveperlprogramming.com/?p=1599" title="Post to Twitter"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-twitter2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Perl+5.18+new+features+http://www.effectiveperlprogramming.com/?p=1599" title="Post to Twitter"> </a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/&amp;title=Perl+5.18+new+features" title="Post to Delicious"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/&amp;title=Perl+5.18+new+features" title="Post to Delicious"> </a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/&amp;title=Perl+5.18+new+features" title="Post to Digg"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/&amp;title=Perl+5.18+new+features" title="Post to Digg"> </a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/&amp;t=Perl+5.18+new+features" title="Post to Facebook"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-facebook.png" alt="Post to Facebook" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/&amp;t=Perl+5.18+new+features" title="Post to Facebook"> </a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/&amp;title=Perl+5.18+new+features" title="Post to Reddit"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/&amp;title=Perl+5.18+new+features" title="Post to Reddit"> </a></p>]]></content:encoded>
			<wfw:commentRss>http://www.effectiveperlprogramming.com/2013/06/perl-5-18-new-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The vertical tab is part of \s in Perl 5.18</title>
		<link>http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/</link>
		<comments>http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/#comments</comments>
		<pubDate>Fri, 07 Jun 2013 17:18:52 +0000</pubDate>
		<dc:creator>brian d foy</dc:creator>
				<category><![CDATA[5.18]]></category>
		<category><![CDATA[regular expressions]]></category>

		<guid isPermaLink="false">http://www.effectiveperlprogramming.com/?p=1601</guid>
		<description><![CDATA[Up to v5.18, the vertical tab wasn&#8217;t part of the \s character class shortcut for ASCII whitespace. No one really knows why. It was curious trivia that I pointed out in Know your character classes under different semantics. Whitespace in ASCII, POSIX, and Unicode represented different sets. Perl whitespace was different from POSIX whitespace by [...]]]></description>
			<content:encoded><![CDATA[<p>Up to v5.18, the vertical tab wasn&#8217;t part of the <code class="regex">\s</code> character class shortcut for ASCII whitespace. No one really knows why. It was curious trivia that I pointed out in <a href="http://www.effectiveperlprogramming.com/2011/01/know-your-character-classes/">Know your character classes under different semantics</a>. Whitespace in ASCII, POSIX, and Unicode represented different sets. Perl whitespace was different from POSIX whitespace by only the exclusion of the vertical tab. Now that little oversight is fixed.</p>
<p>I had this program to mark which sets matched which characters. I required v5.10 because that&#8217;s the first appearance of the <code class="regex">\h</code> and <code class="regex">\v</code> shortcuts for horizontal and vertical whitespace.</p>
<pre class="brush:perl">
use 5.010;

use charnames qw(:full);

print <<"LEGEND";
s   matches \\s, matches Perl whitespace
h   matches \\h, horizontal whitespace
v   matches \\v, vertical whitespace
p   matches [[:space:]], POSIX whitespace
all characters match Unicode whitespace, \\p{Space}

LEGEND

printf qq(%s %s %s %s  %-7s --> %s\n),
	qw( s h v p  Ordinal  Name );
print '-' x 50, "\n";

foreach my $ord ( 0 .. 0x10ffff ) {
	next unless chr($ord) =~ /\p{Space}/;
	my( $s, $h, $v, $posix ) =
		map { chr($ord) =~ m/$_/ ? 'x' : ' ' }
			( qr/\s/, qr/\h/, qr/\v/, qr/[[:space:]]/ );
	printf qq(%s %s %s %s  0x%04X  --> %s\n),
		$s, $h, $v, $posix,
		$ord, charnames::viacode($ord);
	}
</pre>
<p>Under v5.10, the top of the output showed that <code>\s</code> did not include the vertical tab, which the UCS names LINE TABULATION.</p>
<pre class="brush:plain">
$ perl5.10.1 spaces
s   matches \s, matches Perl whitespace
h   matches \h, horizontal whitespace
v   matches \v, vertical whitespace
p   matches [[:space:]], POSIX whitespace
all characters match Unicode whitespace, \p{Space}

s h v p  Ordinal --> Name
--------------------------------------------------
x x   x  0x0009  --> CHARACTER TABULATION
x   x x  0x000A  --> LINE FEED
    x x  0x000B  --> LINE TABULATION
x   x x  0x000C  --> FORM FEED
x   x x  0x000D  --> CARRIAGE RETURN
x x   x  0x0020  --> SPACE
</pre>
<p>Run under v5.18, the output changes slightly to have another <code>x</code> in the third row (line 12).</p>
<pre class="brush:plain">
$ perl5.18.0 spaces
s   matches \s, matches Perl whitespace
h   matches \h, horizontal whitespace
v   matches \v, vertical whitespace
p   matches [[:space:]], POSIX whitespace
all characters match Unicode whitespace, \p{Space}

s h v p  Ordinal --> Name
--------------------------------------------------
x x   x  0x0009  --> CHARACTER TABULATION
x   x x  0x000A  --> LINE FEED
x   x x  0x000B  --> LINE TABULATION
x   x x  0x000C  --> FORM FEED
x   x x  0x000D  --> CARRIAGE RETURN
x x   x  0x0020  --> SPACE
</pre>
<p>I don&#8217;t foresee this breaking anything since the vertical tab seems to be a rare character, although in ETL I liked using it as a separator since I figured no one else would be using it.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18+http://www.effectiveperlprogramming.com/?p=1601" title="Post to Twitter"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-twitter2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18+http://www.effectiveperlprogramming.com/?p=1601" title="Post to Twitter"> </a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/&amp;title=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18" title="Post to Delicious"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/&amp;title=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18" title="Post to Delicious"> </a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/&amp;title=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18" title="Post to Digg"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/&amp;title=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18" title="Post to Digg"> </a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/&amp;t=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18" title="Post to Facebook"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-facebook.png" alt="Post to Facebook" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/&amp;t=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18" title="Post to Facebook"> </a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/&amp;title=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18" title="Post to Reddit"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/&amp;title=The+vertical+tab+is+part+of+%5Cs+in+Perl+5.18" title="Post to Reddit"> </a></p>]]></content:encoded>
			<wfw:commentRss>http://www.effectiveperlprogramming.com/2013/06/the-vertical-tab-is-part-of-s-in-perl-5-18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Effective Perler discounts during OSCON</title>
		<link>http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/</link>
		<comments>http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/#comments</comments>
		<pubDate>Fri, 13 Jul 2012 19:15:13 +0000</pubDate>
		<dc:creator>brian d foy</dc:creator>
				<category><![CDATA[promotion]]></category>

		<guid isPermaLink="false">http://www.effectiveperlprogramming.com/?p=1557</guid>
		<description><![CDATA[I&#8217;ll be at OSCON on Tuesday, July 17, but you don&#8217;t have to find me to get up to 37% off Effective Perl Programming. That&#8217;s a slightly lower price than Amazon. To get that discount, you have to buy the book at Pearson&#8217;s booth in the exhibition hall. You&#8217;ll need to track me down on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be at OSCON on Tuesday, July 17, but you don&#8217;t have to find me to get up to 37% off <i>Effective Perl Programming</i>. That&#8217;s a slightly lower price than Amazon. To get that discount, you have to buy the book at Pearson&#8217;s booth in the exhibition hall. You&#8217;ll need to track me down on Tuesday afternoon or evening if you want me to sign your book.</p>
<p>If you can&#8217;t make it to OSCON, you can still get 35% off the cover price by ordering <a href="http://www.informit.com/promotions/promotion.aspx?promo=138425">directly from the InformIT discount link</a> or using the OSCON2012 discount code when you check out. Instead of navigating their site, you can <a href="http://www.informit.com/store/product.aspx?isbn=0321496949">go directly to our book</a>.</p>
<p>If you&#8217;re not sure you want the book, you can look at <a href="http://www.informit.com/content/images/9780321496942/samplepages/0321496949.pdf">a free sample chapter</a>, which is also 35% off during OSCON.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Effective+Perler+discounts+during+OSCON+http://tinyurl.com/mwueun9" title="Post to Twitter"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-twitter2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Effective+Perler+discounts+during+OSCON+http://tinyurl.com/mwueun9" title="Post to Twitter"> </a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/&amp;title=Effective+Perler+discounts+during+OSCON" title="Post to Delicious"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/&amp;title=Effective+Perler+discounts+during+OSCON" title="Post to Delicious"> </a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/&amp;title=Effective+Perler+discounts+during+OSCON" title="Post to Digg"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/&amp;title=Effective+Perler+discounts+during+OSCON" title="Post to Digg"> </a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/&amp;t=Effective+Perler+discounts+during+OSCON" title="Post to Facebook"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-facebook.png" alt="Post to Facebook" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/&amp;t=Effective+Perler+discounts+during+OSCON" title="Post to Facebook"> </a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/&amp;title=Effective+Perler+discounts+during+OSCON" title="Post to Reddit"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/&amp;title=Effective+Perler+discounts+during+OSCON" title="Post to Reddit"> </a></p>]]></content:encoded>
			<wfw:commentRss>http://www.effectiveperlprogramming.com/2012/07/effective-perler-discounts-during-oscon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Declare your Pod encoding</title>
		<link>http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/</link>
		<comments>http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/#comments</comments>
		<pubDate>Sun, 01 Jul 2012 07:20:43 +0000</pubDate>
		<dc:creator>brian d foy</dc:creator>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[item]]></category>

		<guid isPermaLink="false">http://www.effectiveperlprogramming.com/?p=1551</guid>
		<description><![CDATA[Pod::Simple 3.21 changed its behavior when it encountered a non-ASCII character in Pod without an encoding. Instead of handling it quietly, it now gives a warning. That&#8217;s not so bad, but Test::Pod uses Pod::Simple, and whenever it sees a warning, pod_ok fails, as it did in my Mac::Errors module: # Failed test 'POD test for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://www.metacpan.org/module/Pod::Simple">Pod::Simple</a> 3.21 changed its behavior when it encountered a non-ASCII character in Pod without an encoding. Instead of handling it quietly, it now gives a warning. That&#8217;s not so bad, but <a href="https://www.metacpan.org/module/Test::Pod">Test::Pod</a> uses <a href="https://www.metacpan.org/module/Pod::Simple">Pod::Simple</a>, and whenever it sees a warning, <code>pod_ok</code> fails, as it did in my <a href="http://www.cpantesters.org/cpan/report/e0c5e3c4-c2bf-11e1-aed2-b65908f5d1fc">Mac::Errors</a> module:</p>
<p><br clear="all" /></p>
<pre class="brush:plain">
#   Failed test 'POD test for blib/lib/Mac/Errors.pm'
#   at .../Test/Pod.pm line 182.
# blib/lib/Mac/Errors.pm (2776): Non-ASCII character seen before =encoding in 'donÍt'. Assuming ISO8859-1
# Looks like you failed 1 test of 2.
t/pod.t ...........
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
</pre>
<p>Unfortunately, the Pod tests are the sort that shouldn&#8217;t stop an installation, which is why many developers have a separate area for author tests (which I&#8217;ll cover in an upcoming Item). Outside of that, you have to fix the Pod.</p>
<p>There are two things here. First, I have a genuine error here. The module is auto generated from other source files and the &#8220;donÍt&#8221; is a mistake; it should be &#8220;don’t&#8221; (with a smart quote) or even better, &#8220;don&#8217;t&#8221;. <a href="https://www.metacpan.org/module/Test::Pod">Test::Pod</a> didn&#8217;t catch this before. So, that&#8217;s not bad.</p>
<p>More importantly, telling Perl that the source code is UTF-8 isn&#8217;t enough. When you use the <A href="https://www.metacpan.org/module/utf8">utf8</a> pragma, the <code>perl</code> interpreter reads the source as UTF-8:</p>
<pre class="brush:perl">
use utf8;
</pre>
<p>However, a Pod parser ignores all the code. It looks for Pod sections and never sees that pragma, nor does it care. You have to tell the pod which encoding you have if you want to use something outside of ASCII:</p>
<pre class="brush:perl">
=encoding utf8
</pre>
<p>I hadn&#8217;t used that in <a href="https://www.metacpan.org/module/Mac::Errors">Mac::Errors</a>, or any of my other modules, although in some of them I had used genuine UTF-8 sequences. Now any person using <a href="https://www.metacpan.org/module/Test::Pod">Test::Pod</a> with the latest <a href="https://www.metacpan.org/module/Pod::Simple">Pod::Simple</a> won&#8217;t be able to install those modules normally. That is, until I fix them.</p>
<p>I could use other encodings, such as ISO-8859-1, as long as I declare the right thing and save the file correctly.</p>
<h2>Things to remember</h2>
<ul>
<li>The <A href="https://www.metacpan.org/module/utf8">utf8</a> pragma doesn&#8217;t affect the Pod
<li><a href="https://www.metacpan.org/module/Pod::Simple">Pod::Simple</a> assumes ASCII unless you tell it otherwise
<li>Declare your Pod encoding with the <code>=encoding</code> directive
</ul>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Declare+your+Pod+encoding+http://www.effectiveperlprogramming.com/?p=1551" title="Post to Twitter"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-twitter2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Declare+your+Pod+encoding+http://www.effectiveperlprogramming.com/?p=1551" title="Post to Twitter"> </a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/&amp;title=Declare+your+Pod+encoding" title="Post to Delicious"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/&amp;title=Declare+your+Pod+encoding" title="Post to Delicious"> </a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/&amp;title=Declare+your+Pod+encoding" title="Post to Digg"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/&amp;title=Declare+your+Pod+encoding" title="Post to Digg"> </a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/&amp;t=Declare+your+Pod+encoding" title="Post to Facebook"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-facebook.png" alt="Post to Facebook" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/&amp;t=Declare+your+Pod+encoding" title="Post to Facebook"> </a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/&amp;title=Declare+your+Pod+encoding" title="Post to Reddit"><img class="nothumb" src="http://www.effectiveperlprogramming.com/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/&amp;title=Declare+your+Pod+encoding" title="Post to Reddit"> </a></p>]]></content:encoded>
			<wfw:commentRss>http://www.effectiveperlprogramming.com/2012/07/declare-your-pod-encoding/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
