=>The attached snippet of code produces errors of unitialised value
=>strings for the lines I have marked.  The script compiles OK.  What
=>obvious newbie thing am I missing?
=>
=>Cheers & Thanks
=>
=>Francesco
=>
=>#!/usr/bin/perl -w
=>#
=># add taint check later
=>
=>use CGI qw(:standard);
=>use strict;
=>use CGI::Carp qw(fatalsToBrowser); # remove later
=>use Fcntl qw(:flock);
=>
=>my $filename =  param('filename');
=>my $subject  =  param('subject');
=>my $action   =  param('action');
=>
=>my @subjects = ( 'running', 'computers', 'med_pol', 'med_clin', 'misc', 'links' );
=>my $DATA_DIR = ( "../data/$subject" ); # USE OF UNINITIALISED VALUE IN
=>                                       # CONCATENATION (.)
=>my $COMMENT_DIR = ( "../data/$subject/.comments" );   # USE OF UNINITIALISED
=>                                                      # VALUE IN CONCATENATION
=>
These last two declarations depend on a '$subject' value that may not have
been set in your form so try:

my $Default_Subject = <somevalue>;
my $subject = param('subject') || $Default_Subject;  

OR something like
my $subject = param('subject') || &throw_exception($missing_fields);


Also $q below is never instantiated as in '$q = new CGI' which you
probably don't need because of the 'use CGI qw(:standard)' line above.
You should either use the object approach or functional, probably not
both.


=>( my $today = localtime )  =~ s/ +\d+:\d+:\d+/,/;
=>
=>
=>#( $filename ) = ( $q->param('filename') =~ /^(\d+)$/ );
=>#( $subject  ) = ( $q->param('subject' ) =~ /^(\w+)$/ );
=>#( $action   ) = ( $q->param('action ' ) =~ /^(\w+)$/ ) || 'start' ;
=>
=>
=>if    ( $action eq 'start'   ) { start(); }    # USE OF UNINITIALISED VALUE
=>                                               # IN STRING
=>elsif ( $action eq 'list'    ) { list() ; }
=>elsif ( $action eq 'display' ) { display(); }
=>elsif ( $action eq 'comment' ) { comment(); }
=>else  { start(); }
=>
=>-- 
=>To unsubscribe, e-mail: [EMAIL PROTECTED]
=>For additional commands, e-mail: [EMAIL PROTECTED]
=>
=>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to