[Kc] say STDOUT and warn STDERR

Jonathan Otsuka djgoku at gmail.com
Wed Mar 7 12:30:28 PST 2012


The data file read is usually megabytes in size I keep all off the data and that would eat up a lot of RAM. I like that idea though if it was a smaller data set. 

Jonathan Otsuka

On Mar 7, 2012, at 2:11 PM, ironicface at earthlink.net wrote:

> Ok, I think I understand better now.
> 
> Since STDERR AND STDOUT both just direct to the console, and you essentially want the work to be saved,
> why not open a file handle for the work (and maybe one for the report), and use STDOUT with some interface
> questions (# Review report data (y/n)), to preview the report before you save anything.
> (I.e., send the report to STDOUT before saving a copy of it to the file handle)
> Then have a followup interface question to save or abort, or whatever seems appropriate.
> 
> Teal
> 
> -----Original Message----- 
> From: Jonathan Otsuka 
> Sent: Mar 7, 2012 1:53 PM 
> To: "Kansas City Perl Mongers (kc.pm)" 
> Subject: Re: [Kc] say STDOUT and warn STDERR 
> 
> 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.
> 
> I think I am going to change lines that I want to output to the screen if I redirect STDOUT or not to:
> 
> # since STDERR filehandle is already open for us
> print STDERR "blah";
> 
> Instead of using:
> 
> warn "blah";
> 
> Jonathan Otsuka
> 
> On Mar 7, 2012, at 1:06 PM, Brian Hann <brian.hann at gmail.com> wrote:
> 
>> 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.
>> 
>> On Wed, Mar 7, 2012 at 1:02 PM, Jonathan Otsuka <djgoku at gmail.com> wrote:
>> I want the user to choose what to do with STDOUT and STDERR on CLI. 
>> 
>> Jonathan Otsuka
>> 
>> On Mar 7, 2012, at 12:48 PM, Richard Allen <rsaxvc at gmail.com> wrote:
>> 
>>> You could pipe stderr in the shell seperatelyfrom stdout, but you can also redirect it in perl
>>> http://www.cs.cmu.edu/afs/cs/usr/rgs/mosaic/pl-exp-io.html
>>> The second codesnippet under open has an example
>>> On Mar 7, 2012 12:41 PM, "Jonathan Otsuka" <djgoku at gmail.com> wrote:
>>> 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?
>>> 
>>> Jonathan Otsuka
>>> _______________________________________________
>>> kc mailing list
>>> kc at pm.org
>>> http://mail.pm.org/mailman/listinfo/kc
>>> _______________________________________________
>>> kc mailing list
>>> kc at pm.org
>>> http://mail.pm.org/mailman/listinfo/kc
>> 
>> _______________________________________________
>> kc mailing list
>> kc at pm.org
>> http://mail.pm.org/mailman/listinfo/kc
>> 
>> _______________________________________________
>> kc mailing list
>> kc at pm.org
>> http://mail.pm.org/mailman/listinfo/kc
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/kc/attachments/20120307/d74487d3/attachment.html>


More information about the kc mailing list