Re: Use of uninitialized value Error



"A. Sinan Unur" <1usa@xxxxxxxxxxxxxxxxxxx> wrote in message
news:Xns96B9B709FE392asu1cornelledu@xxxxxxxxxxxx
>
> To suppress the warning, you can use
> no warnings 'unintialized';
>

> > Replace this : my $came_from = $ENV{'HTTP_REFERER'};
>> with : my $came_from = 'I must learn proper CGI programming
first';
>
> and see if the warning disappears.

So what I did was shorten the code, to makefinding this warning more
managable. It is listed below at ***.

But even after changing:
my $came_from = $ENV{'HTTP_REFERER'};
to:
my $came_from = 'You need to learn to be nicer to others';

the warning still occured.

So it's down to what is below, and I finally found the one line I can
comment IN or OUT, and cause the warning to disappear. Essentially, if I
comment out the SECOND line in:

my $ema = "";
$ema = $q->param('email');

then the warning diappears. Which means I really have to ask what is going
on here, because now I am really confused.

As for,

>>>I will also suggest, at the very least, that you use HTML::Template with
your scripts.

Am just curious, for writing small HTML output with my Perl scriptts, which
is why I am trying to do it this way. Is that considered ok? Or must I use
HTML::Template? Am I that wrong in attempting this way?

Thanks again,

Daniel



*** code

#!/usr/bin/perl

use warnings;
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $q = new CGI;
my $out = "Hello";

my $ema = "";
$ema = $q->param('email');

PrintSurvey();
print $q->header();
print $out;
exit 0;


sub PrintSurvey
{
$out = qq^
<HTML>
<HEAD>
<TITLE>Closet Music Survey</TITLE>

</HEAD>
<body bgcolor="#EEEEFF" text="#000000" link="#0000FF" vlink="#660033"
background="">

<FORM name="MusicSurvey" enctype="multipart/form-data"
action="http://www.fourgauchos.com/cgi-bin/recordsurvey_4.pl"; method="POST">
<table border="0" CELLPADDING="5">
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td>
<input type="text" name="email" value="^ . $ema . qq^" maxlength=64
size = 32>
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
</table>
<INPUT type="submit" value="submit">&nbsp;&nbsp;&nbsp;
</form>


</body>
</html>^;
}



.



Relevant Pages

  • Re: Use of uninitialized value Error
    ... >> and see if the warning disappears. ... You must check if valid values were passed to your CGI script. ... return <<SURVEY; ...
    (comp.lang.perl.misc)
  • Re: Is this compiler warning impossible to get rid of?
    ... structures, is sufficient to declare the type, e.g.: ... and the warning disappears. ... this is the safe way to do it. ...
    (comp.lang.java)
  • Re: F10 and beagle?
    ... I have noticed that warning as well. ... Does the change recommended help? ... I set that variable and the warning disappears but still beagled stops ... Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines ...
    (Fedora)
  • CGI.pm v2.91 bug with $q->p()?
    ... I am getting a warning for reasons that I can't understand and I ... simple CGI code below demonstrates the problem, ... # Print the html header ...
    (comp.lang.perl.misc)
  • Re: why these "SHORTTAG YES" warnings?
    ... no BOM. ... my CGI. ... I gather that I should take this warning ... What evil would arise should I fall back to iso-8859? ...
    (comp.infosystems.www.authoring.html)