--- Francesco Scaglioni <[EMAIL PROTECTED]> wrote:
> Hi again,
> 
> the script now reads ( see below ) but I still get errors as follows:
> 
> ** (at end of line) =  where use of uninitialised value in cancatenation and
> *** (at end of line) =  where use of uninitialised value in pattern
> match
> 
> How should I initialise those values?
> 
> Cheers
> 
> Francessco

Francessco,

I have to say, the overall structure of your code looks nice.  There are, however, a 
couple of
things to fix up.

First, the following line imports the CGI.pm methods as functions:

    use CGI qw(:standard);

You have used both the object orient interface to CGI.pm ($q->...) and the function 
oriented
method (param() without the $q->...).  Your code will be much cleaner if you stick 
with one or the
other.  Assuming you want to use the function oriented interface, just drop all 
references to $q. 
I've made some changes to your script below.  Note that the param() calls have a 
default empty
string after them.  This will prevent the variables from being 'undef' if no data is 
passed, thus
preventing 'unitialized value' warnings.  

I also changed the formatting to something that I find a little more esthetically 
pleasing. 
That's just me, though.  Feel free to ignore that part :)
 
    #!/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    = qw/ running computers med_pol med_clin misc links /;
    my $DATA_DIR    = "../data/$subject";
    my $COMMENT_DIR = "../data/$subject/.comments";

    ( my $today = localtime )  =~ s/ +\d+:\d+:\d+/,/;

    ( $filename ) = ( param('filename') =~ /^(\d+)$/ );
    ( $subject  ) = ( param('subject' ) =~ /^(\w+)$/ );
    ( $action   ) = ( param('action ' ) =~ /^(\w+)$/ ) || 'start' ;

    if    ( $action eq 'start'   ) { start(); }
    elsif ( $action eq 'list'    ) { list() ; }
    elsif ( $action eq 'display' ) { display(); }
    elsif ( $action eq 'comment' ) { comment(); }
    else  { start() }

Cheers,
Curtis "Ovid" Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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

Reply via email to