Perl Tutorials - Herong's Tutorial Examples - v6.01, by Dr. Herong Yang
"Refresh" http-equiv Meta Tag
This section provides a tutorial example on how to create 'Refresh' http-equiv Meta Tag in the HTML document header to ask the browser to refresh Web pages.
There is also another way to ask the browser to make a subsequent HTTP request after the current HTML document has been displayed. That is to use the "Refresh" "http-equiv" meta tag in the HTML document header.
Here is a simple example Perl CGI script, CGI-pm-Redirect-URI.pl, to show you how to create the "http-equiv" meta tag with the CGI.pm module.
#!c:/local/perl/bin/perl.exe #- CGI-pm-http-equiv-Refresh.pl #- Copyright (c) HerongYang.com. All Rights Reserved. use CGI; $query = CGI->new(); print $query->header(); #- Set the HEAD elements print $query->start_html( -title=>'A Simple Web Clock', -head=>$query->meta({-http_equiv=>'Refresh', -content=>'1,http://localhost/CGI-pm-http-equiv-Refresh.pl'})); ($sec, $min, $hour) = localtime(time()); print $query->p('Current time: '.$hour.':'.$min.':'.$sec."\n"); print $query->end_html();
Copy CGI-pm-http-equiv-Refresh.pl to C:\local\apache\htdocs.
Now, enter this URI into your browser address: http://localhost/CGI-pm-http-equiv-Refresh.pl. You should see a simple text clock on the browser screen:
Current time: 20:28:33
Notice how the browser makes a request every second to update the time on the clock.
Table of Contents
Data Types: Values and Variables
Expressions, Operations and Simple Statements
Name Spaces and Perl Module Files
Hard References - Addresses of Memory Objects
Objects (or References) and Classes (or Packages)
Typeglob and Importing Identifiers from Other Packages
String Built-in Functions and Performance
File Handles and Data Input/Output
Open Directories and Read File Names
File System Functions and Operations
Socket Communication Over the Internet
XML::Simple Module - XML Parser and Generator
SOAP::Lite - SOAP Server-Client Communication Module
Perl Programs as IIS Server CGI Scripts
CGI (Common Gateway Interface)
XML-RPC - Remote Procedure Call with XML and HTTP
RPC::XML - Perl Implementation of XML-RPC
Integrating Perl with Apache Web Server
►CGI.pm Module for Building Web Pages
Generating HTML Document with CGI.pm
Retrieving Query Parameters and Headers
Retrieving Environment and Script Information
►"Refresh" http-equiv Meta Tag
Retrieving and Setting HTTP Cookies
LWP::UserAgent and Web Site Testing
Converting Perl Script to Executable Binary