USP32547: UNIX Systems Programming- Pkginfo with Perl- Programming Assignment Help

Download Solution Order New Solution
Internal Code: IAH170

Programming Assignment Help:

Task: Title: pkginfo with Perl In this assignment, you will write a Perl program which simulates the behaviour of command pkginfo (a command available in some versions of Unix). Your Perl program will parse a file containing information about installed software packages and will generate output depending on the command line. These are the specifications for your Perl program: 1. It must be named pkginfo.pl 2. It must be invoked as: pkginfo.pl option installed_software_file The program must check that the installed_software_file argument exists, is a file and is readable. If not, it must print an error message to the standard output and exit. The values for the option argument are described below. 3. File installed_software_file can have any arbitrary name. It must be a file of text with the following format: a. The file consists of an arbitrary number of lines (including, possibly, zero lines). b. Each line must contain four fields separated by commas. c. The four fields are: category, name, description, size in kilobytes. d. The category and name fields are each a string of characters of arbitrary (yet reasonably limited) length.Acceptable characters include: lower and upper case letters, digits, underscore, dot. e. The description field is a string of characters of arbitrary (yet reasonably limited) length. Acceptable characters include: lower and upper case letters, digits, underscore, dot, ‘+’, ‘/’, ‘-‘, space. f. The size in kilobytes field is an integer limited between 1 and 10000000. The following is an example of file installed_software_file: system,SUNWdoc,Documentation Tools,1251 application,SPROcpl,C++ Compiler,25477 system,BRCMbnxe,Broadcom NIC Driver,5423 newcat,madeup,a made up line,100000 application,ecj,Eclipse JDT,75443 Very important note: your program is not expected to verify that file installed_software_file complies with the above specifications. It will only be tested with compliant files. 4. Your program can be invoked with option: -a. In this case, it must print the following: Installed software: <first name in appearance order> <second name in appearance order> <last name in appearance order> Example with the example installed_software_file given above: Command line: pkginfo.pl -a installed_software_file Installed software: SUNWdoc SPROcpl BRCMbnxe madeup ecj In the case in which file installed_software_file is empty, your program must instead only print: No software installed 5. Your program can be invoked with option: -s. In this case, it must only print the following string: Total size in kilobytes: <total size in kilobites of all the installed packages> Example with the example installed_software_file given above: Command line: pkginfo.pl –s installed_software_file Output: Total size in kilobytes: 207594 In the case in which file installed_software_file is empty, your program must print: Total size in kilobytes: 0 6. Your program can be invoked with option: -l <name>. Argument <name> follows the same rules as the name field. In this case, it must print: Package <name>: Category: <category> Description: <description> Size in kilobytes: < size in kilobytes> Example with the example installed_software_file given above: Command line: pkginfo.pl –l ecj installed_software_file Output: Package ecj: Category: application Description: Eclipse JDT Size in kilobytes: 75443 In the case in which name <name> is not present in installed_software_file, your program must print: No installed package with this name 7. Your program can be invoked with option: -v. In this case, it must only print your name, surname and student ID in a format of your choice. 8. No options can be used simultaneously. This means that your program can only be invoked with one of the options at a time. 9. If your program is invoked with a valid file argument, but any other syntax than what specified above, it must only print the following string to the standard output: Invalid command syntax Example: Command line: pkginfo.pl -Z installed_software_file Output: Invalid command syntax 10. Zip your file pkginfo.pl into a file named USP_<yourSurname>_<yourStudentID>.zip and submit it with the modalities specified above. Several free zip utilities are available on the WWW.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.