package ProjectPick; =head1 NAME ProjectPick -- Pick a project from existing ones =head1 SYNOPSIS my $boolean = ProjectPick -> new(); =head1 DESCRIPTION This package picks a project for extropy from the existing projects. ProjectCreate, itself, is not an object and cannot be instantiated. =head1 VERSION 0.001 (last update: 6/30/04) =head1 AUTHOR Chet Langin, clangin@siu.edu SIU Plant Biotechnology and Genomics Core-facility =head1 BUGS None known. =head1 SEE ALSO extropy ExtropyConstants ExtropyUtils Extropy::MenuMain =head1 COPYRIGHT Copyright 2004, Chet Langin, All Rights Reserved. This program is free software. You may copy or redistribute it under the same terms as Perl itself. =head1 METHODS The remainder of this document describes the methods available to the programmer. =cut # load the pragmas use warnings; use strict; # load other modules use ExtropyConstants; use ExtropyUtils; =head2 new() my $boolean = ProjectPick->new; Uses dialog boxes and/or menus to pick a project from the existing projects. =cut # package variables # ******************************** new ****************************** sub new { my $self = shift; # self is ProjectPick my $configuration = shift; my $db_manager = shift; my $project = shift; my $project_name = ""; my $project_obtained = TRUE; my $counter = 0; my $user_input = ""; my $loop = TRUE; while($loop) { message_start; message("The following projects are listed in the extropy.cfg"); message("configuration file. Enter the item number to make"); message("your selection."); blank_line; $counter = 0; foreach my $project_name (@{$configuration->{project_array}}) { $counter++; message("$counter $project_name"); } # foreach blank_line; $user_input = prompt("Enter a number from 1 to $counter"); if($user_input eq "Q") { $loop = FALSE; $project_obtained = FALSE; } # if elsif($user_input > 0 && $user_input <= $counter) { $project_name = $configuration->{project_array}[$user_input - 1]; $project->{current_project} = $project_name; # make sure this database is ok if ($db_manager->get_username($project_name)) { if($project->read) { $loop = FALSE; $project_obtained = TRUE; } # if else { if(yes("Create a project configuration file")) { if($project->save) { $loop = FALSE; $project_obtained = TRUE; } # if else { $project_obtained = FALSE; } # else } # if } # else } # if else { $project_obtained = FALSE; } # else } # elsif } # while if($project_obtained) { $project->{current_project} = $configuration->{project_array}[$user_input - 1]; if($db_manager->{reset}) { $project->reset; $db_manager->{reset} = FALSE; } # if TRUE; } # if else { $project->{current_project} = ""; FALSE; } # else } # new 1