Included Files
One feature that is provided by some Web servers is server-side includes. You can configure your Web server in such a way that files of certain extensions (let's use the common one, .shtml) are parsed by the server before they are sent down to the client. There are two directives that tell the server to perform a specific operation with the file.
<!..#echo....>
and
<!..#include...>
The server-side include feature is used to dynamically include nested HTML files. This feature enables some limited dynamically created content. The include directive is used to include other HTML files, much like a C program including header files. The echo directive allows you to dynamically display certain variables. The variables that can be displayed using the echo directive are as follows:
DATE_GMT DATE_LOCAL DOCUMENT_NAME DOCUMENT_URI LAST_MODIFIED QUERY_STRING_UNESCAPED
As you saw previously, all of the HTML that you generate from your Perl script is dynamic. It would be very easy to incorporate this kind of information using simple print statements. For example, to print the local date, instead of using an echo directive you might write the following:
print "The current local time is: " . localtime() . "\n";
Or, to print Greenwich Mean Time, you could write:
print "The current time in Greenwich is: " . gmtime() . "\n";
The include directive of server-side includes can be easily implemented in Perl code, as in List-ing 4.2.