Write a program to manage a user list that can be modified


Integrative Programming

Assignment- Managing a User Account List

Objective:

To manage a user list that can be modified and saved to a text file.

Inputs:

• Input text file consisting of pairs of usernames and passwords, separated by a colon (:) without any spaces

• User choice: (‘a'-add user account, ‘m'-modify existing user account, ‘r'- remove existing user account, ‘g'- generate list of user accounts, ‘q'-quit)

Output:

• List of user accounts, error messages when appropriate

• Output text file consisting of pairs of username and passwords, separated by a colon (:) without any spaces

Specification:

The program manages a list of user accounts and passwords supplied by a system administrator.

Any inputted username should be stripped of any non-alphanumeric characters (special characters such as ! @ # $ % ^ & * ( ) _ + ; : ' "), using regular expression substitution:

$username =~ s/[^a-zA-Z0-9]//g;
and should be converted to lowercase: $username = lc($username);

Any inputted password should be stripped of an apostrophe (other symbols are allowed):
$password =~ s/\'//g;

Each option should be implemented as a separate function within a Package that exports its functions, and the functions are referenced by a hash indexed by the user input (do not rename the input choices, or it will not work correctly when tested):

my %function = (‘a'=>\&add_user, ‘m'=>\&modify_user, ‘r'=>\&remove_user, ‘g'=>\&generate_list);
which can be called by assigning a variable to the key of the hash, such as: my $selection = $function{$choice};
and updating the list stored as a hash as: %hash = $selection->(\%hash) ;

Within each function, access the actual parameter %hash as a local parameter using the shift command: (eg: my $param = shift; my %local_hash = %$param) and update the hash according to the function. The script file (.pl) should import the functions from the package (.pm) file to call the appropriate function.

The program should loop until the user chooses to quit (selects status as ‘q'). If the user enters an illegal status, the program will prompt again for the status input. Upon quitting, the program prompts the user to save the list to a text file of the same name used to initially read the user list.

What to turn in:

A single zipped file (asmt1_yourlastname.zip) containing both source code files (the perl script called: asmt1_yourlastname.pl, and the perl module file called: functs_yourlastname.pm) submitted via Moodle (https://moodle.csun.edu) to the Lab section (not the lecture section). Any deviation from the format for submission will result in an automatic -10%.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write a program to manage a user list that can be modified
Reference No:- TGS01594399

Expected delivery within 24 Hours