The first half of the engine handles the cases where all instructors are selected.
sub _profile_engine {
my $self = shift;
my $request_ref = shift;
my $write = shift if ($_[0]);
my %data = %$self;
my (@sought);
# if no arguments are provided, default to all members of category
if ($request_ref eq 'all') {
push(@sought, $_) foreach (sort keys %data);
# if we're just displaying results on screen ...
if (! $write) {
$self->_profile_subengine(\%data, $_) foreach (@sought);
}
# but if we're writing to file (only one file, in this case) ...
else {
my $output = 'all_in_category.txt';
my $oldfh = select OUT;
open OUT, ">$output" or die;
$self->_profile_subengine(\%data, $_) foreach (@sought);
close OUT or die;
select($oldfh);
}
}
| Previous | Back to start of show | Next |
| Slide: 22 prof_eng_1 | © 2003 James E. Keenan |