NAME
Net::Scan::Fork - A simple way to manage fork processess.
SYNOPSIS
use Net::Scan::Fork;
bla bla
bla bla
Net::Scan::Fork::settings(20,4,3,60);
foreach (@hosts){
Net::Scan::Fork::scan(\&scan,100,$_);
}
Net::Scan::Fork::wait_child;
exit(0);
sub scan{
bla bla
bla bla
}
DESCRIPTION
This module provides you a simple way to manage fork processess. It would be useful in a multiprocess network/security/etc. scanner.
METHODS
settings
Fork settings:
Net::Scan::Fork::settings(20,4,3,60);
You can specify:
- new max processes
-
set a new "max processes" value when the "critic cpu load" has been passed. 20 is a good value;
- critic cpu load
-
when the "critic cpu load" has been passed, the number of processes is decreased to "new max processes" and a sleep of seconds ("sleep time") takes place. 4 is a good value;
- new cpu load
-
is the new limit of the cpu load to check when the critic value has been passed. 3 is a good value;
- sleep time
-
sleep time (in seconds) when the "critic cpu load" value is exceeed; 60 is a good value;
scan
This function executes the code reference passed to it. 100 is the max number of processes value;
Net::Scan::Fork::scan(\&scan,100,$ip);
wait_child
Wait for all the processes which have been forked.
Net::Scan::Fork::wait_child;
BUGS AND LIMITATIONS
A high value of processes could increase too much the cpu load and block the sistem :)
Please send me your feedback.
SEE ALSO
Proc::Fork Parallel::ForkManager
AUTHOR
Matteo Cantoni, <mcantoni@cpan.org>
COPYRIGHT AND LICENSE
You may distribute this module under the terms of the Artistic license. See Copying file in the source distribution archive.
Copyright (c) 2006, Matteo Cantoni