Sponsored Content
Top Forums Shell Programming and Scripting piping and backgroud processes (daemons) Post 302207246 by quine on Thursday 19th of June 2008 12:24:44 PM
Old 06-19-2008
What you are looking for is to set $| = 1; on the currently selected file handle (by default STDOUT). $| also known as $OUTPUT_AUTOFLUSH and also $AUTOFLUSH turns OFF buffering when set and so you will see the results of every print as it happens instead of when perl figures it's time to flush the output buffer. Buffering is ON in perl by default. If you are printing to STDOUT you have only to do a $| = 1; somewhere before your while loop. If you print to some other handle be sure to select(HANDLE); before you assign to $|, etc.
 

9 More Discussions You Might Find Interesting

1. IP Networking

DNS daemons

Does anyone know the command to start the DNS Daemon. I looked in the /etc/init.d/inetsvc file and it tells me what the text should look like. When I go to open the corresponding files they are encoded and I can't read them. So is there a command that will start the DNS daemon? If... (8 Replies)
Discussion started by: Deuce
8 Replies

2. UNIX for Advanced & Expert Users

backgroud process

Hi experts How to write a shell program(sh) that running on the backgroud when foreground processing something, such as prompt ....... till the background process finished. thx (4 Replies)
Discussion started by: trynew
4 Replies

3. UNIX for Dummies Questions & Answers

Daemons

MYSQL-daemon don't started automatically by system-start. And same trouble with httpd too. I have SuSE 8.0. What can I do ? Thanks.... (6 Replies)
Discussion started by: Pennywize
6 Replies

4. Linux

A doubt on Daemons

Hi there! I'm a bit curious on something about Daemons.... Supose you have two processes say A and B, where B is a daemon. A is totally independent from B. Is there a way for A to find out B's return code? Is there a way for A to find out when B ends? Thanks! (4 Replies)
Discussion started by: marioh
4 Replies

5. UNIX for Dummies Questions & Answers

Starting daemons at reboot.

I rebooted my server (solaris 5.8) and I had to manually start the cron and mailx daemons. How do I get these to automatically start at reboot? Thanks in advance. (2 Replies)
Discussion started by: shorty
2 Replies

6. Shell Programming and Scripting

daemons definition

hi there, can somebody give me a definition for daemons, or example what are they !! and what the use for? i've done some research and all what i found is /etc/... or /usr/bin/... and i haven't quietly got the concept. any ideas !! Thanks. (5 Replies)
Discussion started by: new2Linux
5 Replies

7. Shell Programming and Scripting

multiple child scripts running in backgroud, how to use grep on the parent?

Hi I have a shell script A which calls another 10 shell scripts which run in background. How do i make the parent script wait for the child scripts complete, or in other words, i must be able to do a grep of parent script to find out if the child scripts are still running. My Code: ... (5 Replies)
Discussion started by: albertashish
5 Replies

8. HP-UX

status of daemons

Hi there all, Hey, is there a way to get the status of all daemons running on a HPUX? in an easy way? Like the same way how to vieuw the status of packages in cmviewcl. Thanks! (1 Reply)
Discussion started by: draco
1 Replies

9. Shell Programming and Scripting

Running commands in backgroud

I have a small question may be this will be discussed before I have two files file1 and file2 with huge data and I am running the commands as cat file1 |sort & cat file2 |sort & If the session is got disconnected or logout will this command run in background, or shall we use nohup (3 Replies)
Discussion started by: morbid_angel
3 Replies
IO::Pager::Buffered(3)					User Contributed Perl Documentation				    IO::Pager::Buffered(3)

NAME
IO::Pager::Buffered - Pipe deferred output to PAGER if destination is a TTY SYNOPSIS
use IO::Pager::Buffered; { local $token = IO::Pager::Buffered::open *STDOUT; print <<" HEREDOC" ; ... A bunch of text later HEREDOC } { # You can also use scalar filehandles... my $token = IO::Pager::Buffered::open($FH) or warn($!); print $FH "No globs or barewords for us thanks! "; } { # ...or an object interface my $token = new IO::Pager::Buffered; $token->print("OO shiny... "); } DESCRIPTION
IO::Pager subclasses are designed to programmatically decide whether or not to pipe a filehandle's output to a program specified in PAGER; determined and set by IO::Pager at runtime if not yet defined. This subclass buffers all output for display upon exiting the current scope. If this is not what you want look at another subclass such as IO::Pager::Unbuffered. While probably not common, this may be useful in some cases,such as buffering all output to STDOUT while the process occurs, showing only warnings on STDERR, then displaying the output to STDOUT after. Or alternately letting output to STDOUT slide by and defer warnings for later perusal. METHODS
Class-specific method specifics below, others are inherited from IO::Pager. open( [FILEHANDLE] ) Instantiate a new IO::Pager to paginate FILEHANDLE if necessary. Assign the return value to a scoped variable. Output does not occur until all references to this variable are destroyed eg; upon leaving the current scope. See "DESCRIPTION". new( [FILEHANDLE] ) Almost identical to open, except that you will get an IO::Handle back if there's no TTY to allow for IO::Pager agnostic programming. tell( FILEHANDLE ) Returns the size of the buffer in bytes. flush( FILEHANDLE ) Immediately flushes the contents of the buffer. If the last print did not end with a newline, the text from the preceding newline to the end of the buffer will be flushed but is unlikely to display until a newline is printed and flushed. CAVEATS
If you mix buffered and unbuffered operations the output order is unspecified, and will probably differ for a TTY vs. a file. See perlfunc. $, is used see perlvar. SEE ALSO
IO::Pager, IO::Pager::Unbuffered, IO::Pager::Page, AUTHOR
Jerrad Pierce <jpierce@cpan.org> Florent Angly <florent.angly@gmail.com> This module was inspired by Monte Mitzelfelt's IO::Page 0.02 COPYRIGHT AND LICENSE
Copyright (C) 2003-2012 Jerrad Pierce o Thou shalt not claim ownership of unmodified materials. o Thou shalt not claim whole ownership of modified materials. o Thou shalt grant the indemnity of the provider of materials. o Thou shalt use and dispense freely without other restrictions. Or, if you prefer: This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.0 or, at your option, any later version of Perl 5 you may have available. perl v5.16.2 2012-09-04 IO::Pager::Buffered(3)
All times are GMT -4. The time now is 07:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy