On 5/2/05, Paul Kraus <[EMAIL PROTECTED]> wrote: > Most if not all of my perl scripts have a tendency to just hang. No > errors. Not locked up. Hitting the enter keys seems to bring them > back. > Attached is a little test script that is very basic but demonstrates > this. Perhaps it is something on my system but its a real pain in the > but. > > I have other very complex scripts that are reading 10's of thousands > of records from a database that just hang. I actually start the script > and jam on the enter key about 50 times hopping it buffers them so > that the script will run with out me having to switch over every few > minutes and jab on the enter key. > > The 3 Simple scripts. > The one takes stdin checks the first line grabs a code and based on > that code pipes the rest of stdin to another script. > > Input file > ---------- > PC:A1 > one > two > three > four > > director.pl > -------------- > #!/usr/bin/perl > use strict; > use warnings; > my $PerlBinary = 'c:/perl/bin/perl.exe'; > my $ScriptDirectory = "$PerlBinary i:/source/perl/Director"; > my %ProgramCode = ( "A1" => "$ScriptDirectory/cat.pl", > "A2" => "$ScriptDirectory/count.pl"); > my $ProgramCode; > while ( <> ) { > chomp; > if ( /^PC:([\w\d]{2})/ ) { > $ProgramCode = $1; > next; > } > if ( $ProgramCode ) { > if ( $ProgramCode{ $ProgramCode } ) { > open STDOUT, "| $ProgramCode{ $ProgramCode }" > or die "File not found $!\n"; > print "$_\n"; > } > } > } > > cat.pl > -------- > use strict; > use warnings; > > while ( <> ) { > chomp; > print "$_\n"; > } > > after cat.pl is done printing its output it just sits there i hit the > enter key and I get back to the "shell" (I use this term lossely this > is a windows xp box ;) ) > > This program doesn't do anything its not real. Was just used as some > example code for a coworker. > > Paul > odd. If i just type dir where i think the progam is hung i get a directory. So it appears to be ending to the shell just not giving me a new command prompt. I guess i could just add the statement Program ended to the end of my scripts so i know at a glance when they are finished but that seems silly.
Paul -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>