Rob Dixon wrote: > I am running with Net::Ping 2.02, which was the version that came with my > Perl version 5.6.1. It doesn't appear to be dated, apart from a (c) 1996,
Curiouser and curiouser... NAME Net::Ping - check a remote host for reachability $Id: Ping.pm,v 1.6 2002/06/19 15:23:48 rob Exp $ > but it > certainly has no 'bind' method. Mine does, but I just overlooked it--even on my second and third scans. I take it as an object lesson in the way preconceptions can distort perceptions. > The bottom line is that we still don't know why the redirect wouldn't work > on Ram's code. The most likely idea seemed to be that setting the > error status instead of the autoflush to 1 was the cause. I'm a little dubious > about that, as when the execution falls off the end of a Perl program it > executes an implicit 'exit' call for you, which executes an implicit 'close' > on all open file handles, which executes an implicit 'flush' on those handles > before closing them. I don't see, therefore, how this sort of data loss can > result from anything but a hard error. Ramprasad mentioned CTL-C in a folowup. ...So when I do a Ctrl-C the output file must get created !?! , or is it that the buffer is cleared only if the program reaches the end This may have been the problem. When you are writing to a file, the nanocenturies pass very slowly. Interrupting the program in this way would be alomost certain to prevent flushing. But, first, let me check.. ..Yep, sho' nuff, boss--each time I used CTL-C to terminate the process, it either produced a new balnk target file, or overwrote an existing one with nothing. Autoflush helps somewhat, in that everything up to the SIGINT is printed to file. > (Incidentally, something I didn't know before is that $! is a 'magic' variable. > I thought it would be read-only, but it seems that it can be set to an error > code and will return the corresponding message when read. > > print $! = 1; > > prints 'Operation not permitted' on my machine, but is probably > platform-dependent.) > > Cheers, > > Rob Hi Rob, Just for fun: #!perl -w #errcode.pl #use strict; for (1..20) { $! = $_; print "$_: $!\n"; } Hi There,podner E:\d_drive\perlStuff>errcode.pl 1: Operation not permitted 2: No such file or directory 3: No such process 4: Interrupted function call 5: Input/output error 6: No such device or address 7: Arg list too long 8: Exec format error 9: Bad file descriptor 10: No child processes 11: Resource temporarily unavailable 12: Not enough space 13: Permission denied 14: Bad address 15: Unknown error 16: Resource device 17: File exists 18: Improper link 19: No such device 20: Not a directory Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]