Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

One of the main strengths of the Perl programming language are its powerful text manipulation features. In this assignment, you will put them to use for writing a Perl program that can manage a simplified version of the so-called "browser cookies".

These are the specifications for your Perl program:

1.  The file with your program must be named cookiemgr.pl

2.  The program must be invoked as:

cookiemgr.pl  cookies_file [options]  The program must check that its first argument exists, is a file and is readable. If not, it must print string: Error: a valid file must be passed as first argument to the standard output and exit. The first argument is compulsory while the following arguments are optional. The arguments are described in the following.

3.  File cookies_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 three fields separated by commas.

c. The three fields are:

Cookie name, size in bytes and expiry date

d. The cookie name field must be a string with the following format: cookie:username@webaddress

username  is a string of minimum 1 character and maximum 8 characters arbitrarily chosen in ranges a-z, A-Z, 0-9;

webaddress is a string encoding a web address; it cannot contain any @ character. e.  The size in bytes field must be a string encoding a positive integer number. f. The expiry date field must be a string encoding a date in the dd/mm/yyyy format.

The following example is the final specification for the format of file cookies_file: cookie:massimo@xyz.org.au,348,12/01/2013

cookie:qiang@xyz.org.au,322,31/12/2012

cookie:massimo@www.nosite.com.au,36,30/06/2012

cookie:massimo@www.hello.uts.edu.au,128,31/12/2037

cookie:adel@www.nosite.com.au,36,30/06/2011

cookie:qiang@www.nosite.com.au,48,23/11/2012

cookie:JBJones@www.hello.uts.edu.au,128,01/09/2015

3. Important note: your program does not need to verify that file  cookies_file  complies with the specifications. You can simply assume that the file meets all the specifications given above.

4.  Your program can be invoked without any options. In this case, it must only print the following string:

Found cookies for a total size of bytes

Example with the example cookies_file given above: Command line:

cookiemgr.pl cookies_file Output:

Found 7 cookies for a total size of 1046 bytes

In the case in which file cookies_file be empty, your program must instead only print:

No cookies found

5.  Your program can be invoked with option: -u username. In this case, it must only print the following string:

Found cookies for user for a total size of bytes

Example with the example cookies_file given above: Command line:

cookiemgr.pl cookies_file -u massimo Output:

Found 3 cookies for user massimo for a total size of 512 bytes

Option -u username can only be used once per command line (you can only ask for the cookies of one user at a time).

In the case in which file cookies_file contains no cookies for the given username, your program must instead only print:

No cookies found for user

Example with the example cookies_file given above: Command line:

cookiemgr.pl cookies_file -u george Output:

No cookies found for user george

6.  Your program can be invoked with option: -d date. In this case, it must only print the following string:

Found cookies expiring before or on for a total size of bytes

Example with the example cookies_file given above: Command line:

cookiemgr.pl cookies_file -d 31/12/2012 Output:

Found 4 cookies expiring before or on 31/12/2012 for a total size of 442 bytes

Option -d date can only be used once per command line (you can only ask for the cookies for a given date at a time).

In the case in which file cookies_file contains no cookies expiring before or on the given date, your program must instead only print:

No cookies found expiring before or on Example with the example cookies_file given above:

Command line:

cookiemgr.pl cookies_file -u 31/05/2011 Output:

No cookies found expiring before or on 31/05/2011

7.  Your program can be invoked with option: -s. In this case, it must only print your name, surname and student ID in a format of your choice.

8.  The options cannot be used simultaneously. This means that your program can only be invoked in the following way: 1) with no options; 2) with option -u username; 3) with option -d date; 4) with option -s.

9.  If your program is invoked with a valid first argument, but any other syntax than those specified above, it must only print the following string:

Invalid sintax

Example:

Command line:

cookiemgr.pl cookies_file UTS.txt -v Output:

Invalid syntax

10.  Zip your file cookiemgr.pl into a file named

USP__.zip and submit it with the modalities specified above.

Please be reminded that:

  • This assignment must be your own work and you should not be helped by anyone to prepare it in any way;
  • The submission of the assignment is not compulsory to pass the subject and it only counts for ten marks;
  • understanding the assignment specifications is part of the assignment itself and no further instructions will be provided; on the other hand, whatever is not constrained you can implement it according to your own best judgment.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9524755

Have any Question?


Related Questions in Programming Language

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As