<head><style>body{font-size:10pt;font-family:arial,sans-serif;background-color:#ffffff;color:black;}p{margin:0px;}</style></head><body><font color="#000000"><font size="2"><font face="arial,sans-serif">Ok, I think I understand better now.<br><br>Since STDERR AND STDOUT both just direct to the console, and you essentially want the work to be saved,<br>why not open a file handle for the work (and maybe one for the report), and use STDOUT with some interface<br>questions (# Review report data (y/n)), to preview the report before you save anything.<br>(I.e., send the report to STDOUT before saving a copy of it to the file handle)<br>Then have a followup interface question to save or abort, or whatever seems appropriate.<br><br>Teal<br><br></font></font></font><blockquote style="PADDING-LEFT: 5px; MARGIN-LEFT: 0px; BORDER-LEFT: #0000ff 2px solid">-----Original Message-----
<br>From: Jonathan Otsuka <djgoku@gmail.com>
<br>Sent: Mar 7, 2012 1:53 PM
<br>To: "Kansas City Perl Mongers (kc.pm)" <kc@pm.org>
<br>Subject: Re: [Kc] say STDOUT and warn STDERR

<br><br><zzzhtml><zzzhead></zzzhead><zzzbody bgcolor="#FFFFFF"><div>I am using getopt::long so I could add another parameter, but sometimes I want to see the data before I save it to a file.</div><div><br></div><div>I think I am going to change lines that I want to output to the screen if I redirect STDOUT or not to:</div><div><br></div><div># since STDERR filehandle is already open for us</div><div>print STDERR "blah";</div><div><br></div><div>Instead of using:</div><div><br></div><div>warn "blah";<br><br>Jonathan Otsuka</div><div><br>On Mar 7, 2012, at 1:06 PM, Brian Hann <<a target="_blank" href="mailto:brian.hann@gmail.com">brian.hann@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>If it's on the command line, you could use GetOpt::Long::Descriptive to set an optional filename argument for both the normal output and report output and then you wouldn't have to worry about wrangling output stream syntax when running the command.<br>
<br><div class="gmail_quote">On Wed, Mar 7, 2012 at 1:02 PM, Jonathan Otsuka <span dir="ltr"><<a target="_blank" href="mailto:djgoku@gmail.com">djgoku@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF"><div>I want the user to choose what to do with STDOUT and STDERR on CLI. <span class="HOEnZb"><font color="#888888"><br><br>Jonathan Otsuka</font></span></div><div><div class="h5"><div><br>On Mar 7, 2012, at 12:48 PM, Richard Allen <<a target="_blank" href="mailto:rsaxvc@gmail.com">rsaxvc@gmail.com</a>> wrote:<br>
<br></div><div></div><blockquote type="cite"><div><p>You could pipe stderr in the shell seperatelyfrom stdout, but you can also redirect it in perl</p>
<p><a target="_blank" href="http://www.cs.cmu.edu/afs/cs/usr/rgs/mosaic/pl-exp-io.html">http://www.cs.cmu.edu/afs/cs/usr/rgs/mosaic/pl-exp-io.html</a></p>
<p>The second codesnippet under open has an example</p>
<div class="gmail_quote">On Mar 7, 2012 12:41 PM, "Jonathan Otsuka" <<a target="_blank" href="mailto:djgoku@gmail.com">djgoku@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I have a program that process/format a file then prints to STDOUT which I may want to save/redirect to a file. I also create a report of the data that was processed, but I don't want the report output sent to STDOUT and was thinking of using warn since its output is to STDERR. Is there another way or is this the best way?<br>


<br>
Jonathan Otsuka<br>
_______________________________________________<br>
kc mailing list<br>
<a target="_blank" href="mailto:kc@pm.org">kc@pm.org</a><br>
<a target="_blank" href="http://mail.pm.org/mailman/listinfo/kc">http://mail.pm.org/mailman/listinfo/kc</a><br>
</blockquote></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>kc mailing list</span><br><span><a target="_blank" href="mailto:kc@pm.org">kc@pm.org</a></span><br><span><a target="_blank" href="http://mail.pm.org/mailman/listinfo/kc">http://mail.pm.org/mailman/listinfo/kc</a></span></div>
</blockquote></div></div></div><br>_______________________________________________<br>
kc mailing list<br>
<a target="_blank" href="mailto:kc@pm.org">kc@pm.org</a><br>
<a target="_blank" href="http://mail.pm.org/mailman/listinfo/kc">http://mail.pm.org/mailman/listinfo/kc</a><br></blockquote></div><br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>kc mailing list</span><br><span><a target="_blank" href="mailto:kc@pm.org">kc@pm.org</a></span><br><span><a target="_blank" href="http://mail.pm.org/mailman/listinfo/kc">http://mail.pm.org/mailman/listinfo/kc</a></span></div></blockquote></zzzbody></zzzhtml></kc@pm.org></djgoku@gmail.com></blockquote></body>