<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Beautifying Perl</title>
	<link>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/</link>
	<description>Ecchi nanowa ikenai to omoimasu</description>
	<pubDate>Sat, 05 Jul 2008 18:36:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Hongli</title>
		<link>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-9033</link>
		<dc:creator>Hongli</dc:creator>
		<pubDate>Tue, 03 Jun 2008 06:49:52 +0000</pubDate>
		<guid>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-9033</guid>
		<description>1) and 2) Yeah, I'm aware of that. But I prefer object-oriented APIs, they're easier on the eye IMO. Plus I can chain such operations in the "correct" order (i.e. $foo-&gt;grep(...)-&gt;map(..) instead of grep(map(..))).

3) I don't think there's a name that can explain what this library does, without being ridiculously long.</description>
		<content:encoded><![CDATA[<p>1) and 2) Yeah, I&#8217;m aware of that. But I prefer object-oriented APIs, they&#8217;re easier on the eye IMO. Plus I can chain such operations in the &#8220;correct&#8221; order (i.e. $foo->grep(&#8230;)->map(..) instead of grep(map(..))).</p>
<p>3) I don&#8217;t think there&#8217;s a name that can explain what this library does, without being ridiculously long.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Hartmann</title>
		<link>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-9030</link>
		<dc:creator>Kevin Hartmann</dc:creator>
		<pubDate>Mon, 02 Jun 2008 15:16:49 +0000</pubDate>
		<guid>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-9030</guid>
		<description>1) For your first example, is there any reason you can't write something like the example below?

if ( grep {$_ satisfies some condition) } @foo) {
    # do something 
}

2) For removing newlines, use the chomp() function: it will remove the newline for your platform, regardless of whether that's a \r\n, \n, or whatever.
$line =~ s/[\r\n]//g;

For removing leading whitespace, you need to remember that tabs are whitespace, too.
#$line =~ s/^[\s\t]*//;

So, the standard perlish way to remove newlines and strip leading whitespace would be:

chomp($line);
$line =~ s/^\s//g;

3) Why is the module called "Peanuts"? Perl has too many poor choices for names already:
grep instead of "any", for example. Give your module a name that explains at a glance 
what it's trying to do.</description>
		<content:encoded><![CDATA[<p>1) For your first example, is there any reason you can&#8217;t write something like the example below?</p>
<p>if ( grep {$_ satisfies some condition) } @foo) {<br />
    # do something<br />
}</p>
<p>2) For removing newlines, use the chomp() function: it will remove the newline for your platform, regardless of whether that&#8217;s a \r\n, \n, or whatever.<br />
$line =~ s/[\r\n]//g;</p>
<p>For removing leading whitespace, you need to remember that tabs are whitespace, too.<br />
#$line =~ s/^[\s\t]*//;</p>
<p>So, the standard perlish way to remove newlines and strip leading whitespace would be:</p>
<p>chomp($line);<br />
$line =~ s/^\s//g;</p>
<p>3) Why is the module called &#8220;Peanuts&#8221;? Perl has too many poor choices for names already:<br />
grep instead of &#8220;any&#8221;, for example. Give your module a name that explains at a glance<br />
what it&#8217;s trying to do.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hongli</title>
		<link>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-7443</link>
		<dc:creator>Hongli</dc:creator>
		<pubDate>Fri, 30 Nov 2007 08:36:00 +0000</pubDate>
		<guid>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-7443</guid>
		<description>plutard: There doesn't seem to be an authoritative Perl naming convention. I've seen different modules using different conventions. I use camel case in all my Perl projects though.

Andrew: I don't know whether the line contains an end-of-line. It might be \r or \r\n (or perhaps something weird, like \r\r\n) or no newline at all.</description>
		<content:encoded><![CDATA[<p>plutard: There doesn&#8217;t seem to be an authoritative Perl naming convention. I&#8217;ve seen different modules using different conventions. I use camel case in all my Perl projects though.</p>
<p>Andrew: I don&#8217;t know whether the line contains an end-of-line. It might be \r or \r\n (or perhaps something weird, like \r\r\n) or no newline at all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Cholakian</title>
		<link>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-7442</link>
		<dc:creator>Andrew Cholakian</dc:creator>
		<pubDate>Fri, 30 Nov 2007 06:03:54 +0000</pubDate>
		<guid>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-7442</guid>
		<description>Is there a reason you can't use chomp() to cut off the newlines in perl? Unless you don't know if $/ will match the EOL character for the strings you're processing you should be fine.

I'm totally with you on elegance. I get the same longing for ruby everytime I write a line of PHP at work. 
I completely hate PHP's sorting mechanism usort. Check out the docs here http://us.php.net/usort
You could rewrite those 8 lines of sorting code into one with ruby. Also, passing a function by using a string as usort does? How much uglier can it get. Procs and closures rule!</description>
		<content:encoded><![CDATA[<p>Is there a reason you can&#8217;t use chomp() to cut off the newlines in perl? Unless you don&#8217;t know if $/ will match the EOL character for the strings you&#8217;re processing you should be fine.</p>
<p>I&#8217;m totally with you on elegance. I get the same longing for ruby everytime I write a line of PHP at work.<br />
I completely hate PHP&#8217;s sorting mechanism usort. Check out the docs here <a href="http://us.php.net/usort" rel="nofollow">http://us.php.net/usort</a><br />
You could rewrite those 8 lines of sorting code into one with ruby. Also, passing a function by using a string as usort does? How much uglier can it get. Procs and closures rule!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: plutard</title>
		<link>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-7441</link>
		<dc:creator>plutard</dc:creator>
		<pubDate>Fri, 30 Nov 2007 00:41:52 +0000</pubDate>
		<guid>http://izumi.plan99.net/blog/index.php/2007/11/29/beautifying-perl/#comment-7441</guid>
		<description>Why the camel-case method names? That's so un-perlish *and*
un-rubyish.</description>
		<content:encoded><![CDATA[<p>Why the camel-case method names? That&#8217;s so un-perlish *and*<br />
un-rubyish.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
