Defining a Report Template

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email

The format function defines the format of the report. The write function prints the report - you can print to the standard output or any other file,

Using the format function

You use the format function to specify the layout of a report. The syntax of the file format function is as follows :
format NAME =
# Comment lines that begin with a #
# Pairs if picture and argument lines. If a picture
# line does not have arguments, there is no need for
# any argument line. Do not place a comment between
#the picture line and the argument line
PICTURE LINE
ARGUMENT LINE
# A single period on a line ends the format

The first line starts with the format function, which is followed by a name for this report template. The name of the format should be the same as the name of the filehandle where the report is printed. If you omit the filehandle, NAME is assumed to be STDOUT (in other words, the report is being printed on standard output). The format definition ends with a line containing a single period.

Between the first and last lines, you can have some comment lines - the convention is the same as other Perl comments ; a comment line begins with a #. Besides the comments (which may explain the layout of the report), the format specification contains pairs of PICTURE LINE and ARGUMENT LINE.

Each PICTURE LINE defines the layout of a line in the report. Special symbols designate fields, the amount of space assigned to a field, and the alignment of the value (for example, right - justified) in the field. The ARGUMENT LINE immediately following a PICTURE LINE provides the arguments that are used for that line of output.

However, nothing happens as a result of the format function ; the result occurs only when the write function is called to generate the report. That means you can place the formats anywhere in the program, It's a good idea, however to keep them all together in one-place - either at the beginning or at the end of a program.



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.