C
chaitu
Hi folks,
I've created a perl module MakeCVSStructure in which I've coded 2
functions called CheckoutAllSubDirs and CheckoutSubDir respectively.
This module and its functions are intended to help me maintain my CVS
working copies.
In MakeCVSStructure.pm:
--------------------------------------
use Parallel::ForkManager;
....bla bla...some more functions go here...
sub CheckoutSubDir
{
my $self = shift;
my $sub_dir_name = shift;
chdir $self->{TOPDIR};
$ENV{CVSROOT}=<The value goes here...it's confidential...>;
system("cvs -q checkout -r $self->{TAG} -P $sub_dir_name");
print "\nCVS Checkout of module $sub_dir_name successful!\n" if $? ==
0;
}
sub CheckoutAllSubDirs
{
# The subdirs need to be checked out in a parallel fashion!
# Code goes here...
my $self = shift;
my $sub_dir_list = $self->{SUBDIRLIST};
my $no_of_subdirs = @$sub_dir_list;
print "\nNo. of subdirectories = $no_of_subdirs\n";
my $pm = new Parallel::ForkManager();
foreach my $subdir (@$sub_dir_list)
{
print "\nSpawning $subdir now...\n";
$pm->start and next;
print "\nInside child process for $subdir now...\n";
$self->CheckoutSubDir($subdir);
$pm->finish;
}
$pm->wait_all_children;
}
When I create an object of this class in my .pl file and run the .pl
file as follows, it does NOT start parallel checkouts of the CVS
modules, but goes in a serial fashion.....
Code of my .pl :
------------------------
use MakeCVSStructure;
my $sub_dir_list =
["admin","build","host","server","thirdparty","tools"];
my ($drive, $topdirname, $tag) = @ARGV;
my $MyCVSObj = MakeCVSStructure->new();
$MyCVSObj->SetTopDir("${drive}:\\${topdirname}");
$MyCVSObj->SetTag("$tag");
$MyCVSObj->SetSubDirList($sub_dir_list);
$MyCVSObj->GetDetails;
$MyCVSObj->MakeTopDir;
$MyCVSObj->CheckoutAllSubDirs;
Could the gurus please tell me why the checkouts aren't happening in a
parallel fashion as I expected them to?
Thnx a million for the help...
I've created a perl module MakeCVSStructure in which I've coded 2
functions called CheckoutAllSubDirs and CheckoutSubDir respectively.
This module and its functions are intended to help me maintain my CVS
working copies.
In MakeCVSStructure.pm:
--------------------------------------
use Parallel::ForkManager;
....bla bla...some more functions go here...
sub CheckoutSubDir
{
my $self = shift;
my $sub_dir_name = shift;
chdir $self->{TOPDIR};
$ENV{CVSROOT}=<The value goes here...it's confidential...>;
system("cvs -q checkout -r $self->{TAG} -P $sub_dir_name");
print "\nCVS Checkout of module $sub_dir_name successful!\n" if $? ==
0;
}
sub CheckoutAllSubDirs
{
# The subdirs need to be checked out in a parallel fashion!
# Code goes here...
my $self = shift;
my $sub_dir_list = $self->{SUBDIRLIST};
my $no_of_subdirs = @$sub_dir_list;
print "\nNo. of subdirectories = $no_of_subdirs\n";
my $pm = new Parallel::ForkManager();
foreach my $subdir (@$sub_dir_list)
{
print "\nSpawning $subdir now...\n";
$pm->start and next;
print "\nInside child process for $subdir now...\n";
$self->CheckoutSubDir($subdir);
$pm->finish;
}
$pm->wait_all_children;
}
When I create an object of this class in my .pl file and run the .pl
file as follows, it does NOT start parallel checkouts of the CVS
modules, but goes in a serial fashion.....
Code of my .pl :
------------------------
use MakeCVSStructure;
my $sub_dir_list =
["admin","build","host","server","thirdparty","tools"];
my ($drive, $topdirname, $tag) = @ARGV;
my $MyCVSObj = MakeCVSStructure->new();
$MyCVSObj->SetTopDir("${drive}:\\${topdirname}");
$MyCVSObj->SetTag("$tag");
$MyCVSObj->SetSubDirList($sub_dir_list);
$MyCVSObj->GetDetails;
$MyCVSObj->MakeTopDir;
$MyCVSObj->CheckoutAllSubDirs;
Could the gurus please tell me why the checkouts aren't happening in a
parallel fashion as I expected them to?
Thnx a million for the help...