Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Did ChatGPT do a good job?

by haj (Vicar)
on Mar 29, 2023 at 21:38 UTC ( [id://11151328]=note: print w/replies, xml ) Need Help??


in reply to Did ChatGPT do a good job?

What do you think? Any other problems i didn't catch?

Two things:

  • The detection of the child process is bogus. In Perl, ($pid == 0) evaluates to true if $pid is undefined. So, if forking fails, then the parent will call doWork before exiting normally. elsif (!defined $pid) will never be evaluated.
  • $SIG{CHLD} is defined only after the round of forks. If a child dies before the sub is defined, then it won't be restarted.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11151328]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-24 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found