Title: pkginfo with Perl
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:
It must be named [login to view URL]
It must be invoked as:
[login to view URL] 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.
File installed_software_file can have any arbitrary name. It must be a file of text with the following format:
The file consists of an arbitrary number of lines (including, possibly, zero lines).
Each line must contain four fields separated by commas.
The four fields are: category, name, description, size in kilobytes.
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.
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.
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.
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:
[login to view URL] -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
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: [login to view URL] –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
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:
[login to view URL] –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
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.
No options can be used simultaneously. This means that your program can only be invoked with one of the options at a time.
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: [login to view URL] -Z installed_software_file
Output:
Invalid command syntax
Zip your file [login to view URL] 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.
Hello Sir/mam,
AS per your requirement
I have all skills required for you project.
I am able to give you project on time in appropriate rate.
Looking for you.
Thanks!!!
Stay tuned, I'm still working on this proposal.