package CGI::NMS::Script; use strict; use CGI; use POSIX qw(locale_h strftime); use CGI::NMS::Charset; =head1 NAME CGI::NMS::Script - base class for NMS script modules =head1 SYNOPSYS use base qw(CGI::NMS::Script); ... =head1 DESCRIPTION This module is a base class for the C modules, which implement plugin replacements for Matt Wright's Perl CGI scripts. =head1 CONSTRUCTORS =over =item new ( CONFIG ) Creates a new C object and performs compile time initialisation. CONFIG is a key,value,key,value list, which will be stored as a hash within the object, under the name C. =cut sub new { my ($pkg, @cfg) = @_; my $self = bless {}, $pkg; $self->{CFG} = { DEBUGGING => 0, emulate_matts_code => 0, secure => 1, locale => '', charset => 'iso-8859-1', style => '', cgi_post_max => 1000000, cgi_disable_uploads => 1, $self->default_configuration, @cfg }; $self->{Charset} = CGI::NMS::Charset->new( $self->{CFG}{charset} ); $self->init; return $self; } =back =item CONFIGURATION SETTINGS Values for the following configuration settings can be passed to new(). Subclasses for different NMS scripts will define their own set of configuration settings, but they all inherit these as well. =over =item C If this is set to a true value, then the error message will be displayed in the browser if the script suffers a fatal error. This should be set to 0 once the script is in service, since error messages may contain sensitive information such as file paths which could be useful to attackers. Default: 0 =item C The name and version of the NMS script, as a single string. =item C When this variable is set to a true value (e.g. 1) the script will work in exactly the same way as its counterpart at Matt's Script Archive. If it is set to a false value (e.g. 0) then more advanced features and security checks are switched on. We do not recommend changing this variable to 1, as the resulting drop in security may leave your script open to abuse. Default: 0 =item C When this variable is set to a true value (e.g. 1) many additional security features are turned on. We do not recommend changing this variable to 0, as the resulting drop in security may leave your script open to abuse. Default: 1 =item C This determines the language that is used in the format_date() method - by default this is blank and the language will probably be English. Default: '' =item C The character set to use for output documents. Default: 'iso-8859-1' =item C