<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments for Masao Kitamura</title>
	<atom:link href="http://www.masaokitamura.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.masaokitamura.com</link>
	<description>The Blog</description>
	<lastBuildDate>Thu, 11 Feb 2010 14:57:50 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on How To Redirect STDERR to STDOUT in Perl by sinx</title>
		<link>http://www.masaokitamura.com/2009/08/28/how-to-redirect-stderr-to-stdout-in-perl/comment-page-1/#comment-479</link>
		<dc:creator>sinx</dc:creator>
		<pubDate>Thu, 11 Feb 2010 14:57:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=333#comment-479</guid>
		<description>Hello, 


Think about this code in context of redirecting STDOUT, STDERR:

#!/usr/bin/perl

use strict;
use warnings;


use POSIX qw(:errno_h ceil floor :sys_wait_h);


my @run = (  &#039;ls&#039;, &#039;-al&#039; );
my $pid = fork();
die &quot;Unable to fork $!&quot; unless defined($pid);
if (!$pid) {  # child
        open(LOG,&quot;&gt;&quot;, &quot;foo-log.log&quot;);
        #close(STDERR);
        #close(STDOUT);
        #open STDERR, &quot;&gt;&gt;&amp;LOG&quot;;
        #open STDOUT, &quot;&gt;&gt;&amp;LOG&quot;;
        *STDERR = *LOG;
        *STDOUT = *LOG;
        print LOG &quot;PRINT TO LOG\n\n&quot;;

        exec { $run[0] } @run;
        die &quot;Unable to execute: $!&quot;;
}
waitpid($pid, WNOHANG);


and output is shown on terminal not in log file:


but when running this:

#!/usr/bin/perl

use strict;
use warnings;


use POSIX qw(:errno_h ceil floor :sys_wait_h);


my @run = (  &#039;ls&#039;, &#039;-al&#039; );
my $pid = fork();
die &quot;Unable to fork $!&quot; unless defined($pid);
if (!$pid) {  # child
        open(LOG,&quot;&gt;&quot;, &quot;foo-log.log&quot;);
        close(STDERR);
        close(STDOUT);
        open STDERR, &quot;&gt;&gt;&amp;LOG&quot;;
        open STDOUT, &quot;&gt;&gt;&amp;LOG&quot;;
        #*STDERR = *LOG;
        #*STDOUT = *LOG;
        print LOG &quot;PRINT TO LOG\n\n&quot;;

        exec { $run[0] } @run;
        die &quot;Unable to execute: $!&quot;;
}
waitpid($pid, WNOHANG);


Everything is ok, maybe you know why:

*STDERR = *LOG;
*STDOUT = *LOG;

doesn&#039;t work?</description>
		<content:encoded><![CDATA[<p>Hello, </p>
<p>Think about this code in context of redirecting STDOUT, STDERR:</p>
<p>#!/usr/bin/perl</p>
<p>use strict;<br />
use warnings;</p>
<p>use POSIX qw(:errno_h ceil floor :sys_wait_h);</p>
<p>my @run = (  &#8216;ls&#8217;, &#8216;-al&#8217; );<br />
my $pid = fork();<br />
die &#8220;Unable to fork $!&#8221; unless defined($pid);<br />
if (!$pid) {  # child<br />
        open(LOG,&#8221;&gt;&#8221;, &#8220;foo-log.log&#8221;);<br />
        #close(STDERR);<br />
        #close(STDOUT);<br />
        #open STDERR, &#8220;&gt;&gt;&amp;LOG&#8221;;<br />
        #open STDOUT, &#8220;&gt;&gt;&amp;LOG&#8221;;<br />
        *STDERR = *LOG;<br />
        *STDOUT = *LOG;<br />
        print LOG &#8220;PRINT TO LOG\n\n&#8221;;</p>
<p>        exec { $run[0] } @run;<br />
        die &#8220;Unable to execute: $!&#8221;;<br />
}<br />
waitpid($pid, WNOHANG);</p>
<p>and output is shown on terminal not in log file:</p>
<p>but when running this:</p>
<p>#!/usr/bin/perl</p>
<p>use strict;<br />
use warnings;</p>
<p>use POSIX qw(:errno_h ceil floor :sys_wait_h);</p>
<p>my @run = (  &#8216;ls&#8217;, &#8216;-al&#8217; );<br />
my $pid = fork();<br />
die &#8220;Unable to fork $!&#8221; unless defined($pid);<br />
if (!$pid) {  # child<br />
        open(LOG,&#8221;&gt;&#8221;, &#8220;foo-log.log&#8221;);<br />
        close(STDERR);<br />
        close(STDOUT);<br />
        open STDERR, &#8220;&gt;&gt;&amp;LOG&#8221;;<br />
        open STDOUT, &#8220;&gt;&gt;&amp;LOG&#8221;;<br />
        #*STDERR = *LOG;<br />
        #*STDOUT = *LOG;<br />
        print LOG &#8220;PRINT TO LOG\n\n&#8221;;</p>
<p>        exec { $run[0] } @run;<br />
        die &#8220;Unable to execute: $!&#8221;;<br />
}<br />
waitpid($pid, WNOHANG);</p>
<p>Everything is ok, maybe you know why:</p>
<p>*STDERR = *LOG;<br />
*STDOUT = *LOG;</p>
<p>doesn&#8217;t work?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Perl Version of PHP&#8217;s &#8220;ucwords&#8221; Function by eunice</title>
		<link>http://www.masaokitamura.com/2009/12/15/perl-version-of-phps-ucwords-function/comment-page-1/#comment-477</link>
		<dc:creator>eunice</dc:creator>
		<pubDate>Tue, 12 Jan 2010 14:53:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=382#comment-477</guid>
		<description>hi! muxtah?</description>
		<content:encoded><![CDATA[<p>hi! muxtah?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hotel Room Problem by Masao</title>
		<link>http://www.masaokitamura.com/2009/08/28/hotel-room-problem/comment-page-1/#comment-353</link>
		<dc:creator>Masao</dc:creator>
		<pubDate>Sat, 29 Aug 2009 00:37:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=338#comment-353</guid>
		<description>They only payed the manager 25 dollars, as he gave 5 back to the bellboy. They payed $9 total, including the bellboy’s tip. $25 with the manager, $3 with the men, $2 with the bellboy.</description>
		<content:encoded><![CDATA[<p>They only payed the manager 25 dollars, as he gave 5 back to the bellboy. They payed $9 total, including the bellboy’s tip. $25 with the manager, $3 with the men, $2 with the bellboy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Monty Hall Problem by Masao</title>
		<link>http://www.masaokitamura.com/2009/08/13/monty-hall-problem/comment-page-1/#comment-345</link>
		<dc:creator>Masao</dc:creator>
		<pubDate>Tue, 18 Aug 2009 20:38:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=308#comment-345</guid>
		<description>Answer: You should always switch, because you have a 2/3 chance of switching to the “right” option.</description>
		<content:encoded><![CDATA[<p>Answer: You should always switch, because you have a 2/3 chance of switching to the “right” option.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 8 Bricks Problem by Masao</title>
		<link>http://www.masaokitamura.com/2009/08/13/8-bricks-problem/comment-page-1/#comment-344</link>
		<dc:creator>Masao</dc:creator>
		<pubDate>Tue, 18 Aug 2009 20:38:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=313#comment-344</guid>
		<description>Answer: Put 3 and 3 on the balance, if it&#039;s even, put the last 2 on the balance.   If not even, put 2 of the last 3 on the balance.  If the last 2 balance, it&#039;s the 3rd brick!</description>
		<content:encoded><![CDATA[<p>Answer: Put 3 and 3 on the balance, if it&#8217;s even, put the last 2 on the balance.   If not even, put 2 of the last 3 on the balance.  If the last 2 balance, it&#8217;s the 3rd brick!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Burning Rope Problem by Masao</title>
		<link>http://www.masaokitamura.com/2009/08/13/burning-rope-problem/comment-page-1/#comment-343</link>
		<dc:creator>Masao</dc:creator>
		<pubDate>Tue, 18 Aug 2009 20:36:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=317#comment-343</guid>
		<description>Answer:

Start the timer.

Burn one at both ends.  Burn the other at one end.

When the first is completely burned, start burning the other end of the second.

When the second is burned completely, 45 minutes have elapsed.</description>
		<content:encoded><![CDATA[<p>Answer:</p>
<p>Start the timer.</p>
<p>Burn one at both ends.  Burn the other at one end.</p>
<p>When the first is completely burned, start burning the other end of the second.</p>
<p>When the second is burned completely, 45 minutes have elapsed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Disable auto commenting in VIM using the .vimrc file by Dallace</title>
		<link>http://www.masaokitamura.com/2008/11/25/disable-auto-commenting-in-vim-using-the-vimrc-file/comment-page-1/#comment-342</link>
		<dc:creator>Dallace</dc:creator>
		<pubDate>Tue, 18 Aug 2009 18:01:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=73#comment-342</guid>
		<description>Thanks!  That has been bugging me for a while</description>
		<content:encoded><![CDATA[<p>Thanks!  That has been bugging me for a while</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Disable Media Manager Services by Superporky</title>
		<link>http://www.masaokitamura.com/2009/03/31/how-to-disable-media-manager-services/comment-page-1/#comment-311</link>
		<dc:creator>Superporky</dc:creator>
		<pubDate>Wed, 29 Jul 2009 01:16:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=192#comment-311</guid>
		<description>Awesome!!  Thanks!</description>
		<content:encoded><![CDATA[<p>Awesome!!  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on MySQL Schema Best Practices by Oliver Nassar</title>
		<link>http://www.masaokitamura.com/2009/05/14/mysql-schema-best-practices/comment-page-1/#comment-306</link>
		<dc:creator>Oliver Nassar</dc:creator>
		<pubDate>Mon, 20 Jul 2009 21:45:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=235#comment-306</guid>
		<description>&quot;Use singular table names, unless a row represents a plural object&quot;

I don&#039;t follow that. Semantically, a table should be entitled &#039;chairs&#039; if it&#039;s a collection of individual chair records, no? A table being entitled &#039;chair&#039; doesn&#039;t make much sense, imo.</description>
		<content:encoded><![CDATA[<p>&#8220;Use singular table names, unless a row represents a plural object&#8221;</p>
<p>I don&#8217;t follow that. Semantically, a table should be entitled &#8216;chairs&#8217; if it&#8217;s a collection of individual chair records, no? A table being entitled &#8216;chair&#8217; doesn&#8217;t make much sense, imo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Make Firefox Always Start a New Session by Jimage</title>
		<link>http://www.masaokitamura.com/2008/12/03/how-to-make-firefox-always-start-a-new-session/comment-page-1/#comment-304</link>
		<dc:creator>Jimage</dc:creator>
		<pubDate>Sun, 19 Jul 2009 13:19:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.masaokitamura.com/?p=91#comment-304</guid>
		<description>Nice, just what I needed.</description>
		<content:encoded><![CDATA[<p>Nice, just what I needed.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
