freelanceprogrammers.org Forum Index » Perl

readline <STDIN> without waiting.


View user's profile Post To page top
josegarciaju... Posted: Sun Mar 06, 2005 6:37 pm


Joined: 07 Mar 2005

Posts: 6
readline <STDIN> without waiting.
Exists any way to readline enter in a loop when enter in STDIN input.
I need a input but not depends a user entry to program continue
running.

It`s also like something to tkRunning(1) BUT to <STDIN> :)

"tkRunning - makes Tk event loop run when waiting for user input
(i.e., during readline method). "

anybody knows ? :)

tks !
Reply with quote
Send private message
View user's profile Post To page top
whinnim Posted: Mon Mar 07, 2005 3:25 am


Joined: 07 Mar 2005

Posts: 4
readline <STDIN> without waiting.
--- In perl_official@yahoogroups.com, Garcia <garciajr@g...> wrote:
>
> Exists any way to readline enter in a loop when enter in STDIN input.
> I need a input but not depends a user entry to program continue
> running.
>
> It`s also like something to tkRunning(1) BUT to <STDIN> :)
>
> "tkRunning - makes Tk event loop run when waiting for user input
> (i.e., during readline method). "
>
> anybody knows ? :)
>
> tks !
my $rin=``;
my $rout;
vec($rin,fileno STDIN,1)=1;
while( !select($rout=$rin, undef, undef, 0) ){
print "continue running
";
sleep 1;
}
$_ = <STDIN>;
print $_;
Reply with quote
Send private message
View user's profile Post To page top
merlynstoneh... Posted: Tue Mar 08, 2005 6:17 am


Joined: 21 May 2004

Posts: 44
readline <STDIN> without waiting.
>>>>> "whinnim" == whinnim <dmi@...> writes:

whinnim> while( !select($rout=$rin, undef, undef, 0) ){
whinnim> print "continue running
";
whinnim> sleep 1;
whinnim> }
whinnim> $_ = <STDIN>;
whinnim> print $_;

Do not mix buffered input (like reading <STDIN>) with select().

Bad Things Will Happen.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help