Question: *PERL SCRIPTING LANGUAGE* Assignment: Create a module that stores a list, or collection of information. The specifications for the interface must be followed exactly as

*PERL SCRIPTING LANGUAGE*

Assignment:

Create a module that stores a list, or collection of information. The specifications for the interface must be followed exactly as listed below. The module MUST be named ListUtil.pm. Export all the subroutines, do not export any data. Note that this does not implement an object, right now you will only be able to have a single list. Well get to objects later in the semester.

Specifics:

The subroutines required for the list module are: name (nameOfList) If passed a single argument this subroutine stores an internal name for the list. The name might be for tomorrow, or next week, or by the end of the semester. If no argument is passed to the subroutine return the current name of the list. The default name of the list should be an empty string. addItem (item) - Adds item to the list. Each item in the list must be unique. Returns a true value if the item was actually added to the list, otherwise it returns a false value. Regardless of the return value, item will be in the list after this sub exits. removeItem (item) Removes item from the list. Returns a true value if item was actually removed from the list, otherwise it returns a false value. isInList (item) - return true if item is in the list, otherwise it returns false. saveToFile (fileName) - saves the name of the list and all of items in the list to the file specified in fileName. loadFromFile (fileName) fills the module with the name of the list and all of items stored in the file fileName. The module should only contain items from the file following this command. count () returns the number of items currently in the list list() if this subroutine is not passed an argument it should return a reference to an array containing the items in the module. If passed -type as the first argument, the second argument will be how to return the list. If the second argument is array, return the data in the list as an array. If the second argument is ref, return a reference to an array containing the items in the module (same as not passing in any arguments). If list is passed a single argument, or if either argument does not match the specific values, do nothing other than return a false value. Requirements:

A package/module and separate file to test the module.

Use of shbang.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!