On Thursday, September 30, 2021 9:30:01 PM CEST Andy Bach wrote: > > https://perldoc.perl.org/functions/print says that 'print' would return > > true > > > if successful and doesn't say what it returns otherwise. It also says > > that > > > "Printing to a closed pipe or socket will generate a SIGPIPE signal." > > Looks like print returns 1 if it succeeds, undef if not: > $ perl -wE 'my $res = print "hi mom\n"; say $res' > hi mom > 1 > $ perl -wE 'my $res = print OUT "hi mom\n"; say $res' > Name "main::OUT" used only once: possible typo at -e line 1. > print() on unopened filehandle OUT at -e line 1. > Use of uninitialized value $res in say at -e line 1. > $ perl -E 'open(OUT, ">", STDERR) ;my $res = print OUT "hi mom\n"; say $res' > 1 > $ perl -wE 'open(OUT, ">", STDERR); close OUT ;my $res = print OUT "hi > mom\n"; say $res' > print() on closed filehandle OUT at -e line 1. > Use of uninitialized value $res in say at -e line 1. > > >So I tried to install a signal handler, but either I did that wrong, or no > > signal was generated. What can I do? > > Well, seeing a SIGPIPE would mean it's failed already, so it's not going to > get you any further. Showing your code might help in debugging.
If the signal would be caught, I could handle the error and try to reconnect, or, if that also fails, do something else. The source is here: https://www.adminart.net/Relaiscontrol.pm.html https://www.adminart.net/Relaiscontrol.pm.gz It's for controlling this relais: https://www.adminart.net/Relaiscontrol.pm.gz It works fine, I just would like to add some more error handling. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/