What's with the fork at the end of the while($ref = $result->fetchrow_hashref) loop?
$data and $result are being destroyed in each of your children. That can have unfortunate side effects. You should be using _exit (in POSIX) instead of exit.
General rule: require and use are for modules that have a package statement. do is for those without. This applies here.
As for your actual question, turn on your warnings and pay attention to them. You should be getting a few "Subroutine insertrecord redefined" errors. Suggested fix:
#!/usr/bin/perl ... use Scraping::Amazon; ... Scraping::Amazon::get($ref->{OEM_PartNum}, $ref->{Description}); ...
scraping/amazon.pm: (File "amazon.pm" — note the extension change — in subdirectory "scraping")
package Scraping::Amazon; ... sub get { ... } sub insertrecords { ... } 1;
You don't have to use a subdirectory. Just remove "Scraping::" from everywhere if you put the modules in the same dir as the main script.
In reply to Re^5: weird issue with HTML::TokeParser and Fork
by ikegami
in thread [Click the star to watch this topic] weird issue with HTML::TokeParser and Fork
by arikamir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |