You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Introduction

The script table.pl takes PingER data and provides a table for RTTs from monitored to monitoring hosts. The script was originally written by Dr. Les Cottrell. Later Zafar Gilani modified it. The script now conforms to perl warnings and tainting mode. New version is now installed both at SLAC and SEECS.

Changes in Version 0.6, Dated 10/07/2010

This tutorial assumes that the reader has basic knowledge of Perl scripting.

Using "strict"

To make sure all the variables (scalars, arrays and hashes) are declared before usage, use the following line just below top of the script:

..
use strict;
..
Using "warnings" and "tainting"

To make sure that all warnings are displayed at the standard output (stdout) one should enable warnings. This helps to solve problems with a script.

Tainting on the other hand is used to make sure that a CGI script is logically secure. Taint (T) mode puts a Perl script into paranoid mode and treats all user supplied input as tainted and bad unless the programmer explicitly OKs the data. Read more here.

To display warnings (w) and enable tainting (T), add the following line at the top of the script:

#!/usr/bin/perl -wT

The above is pretty much an older style of Perl coding. One can also use:

..
use warnings;
..

Once tainting is enabled, it has to be used at the command prompt as well or the script won't run. If one tried to run the script without tainting option (-T) from command line, the script fails with following message:

zafar@pinger $ perl table.pl
"-T" is on the #! line, it must also be used on the command line at table.pl line 1.
  • No labels