Use of uninitialized value in substitution iterator at formication.pl line 153.
Here is the code:
_____________________________________
1 #!/usr/bin/perl -wT
17
18 $¦ = 1;
19
20 open(STDERR, ">&STDOUT") ¦¦ die "Can't redirect stderr";
21
22 use CGI;
23 use CGI::Carp qw(fatalsToBrowser);
24 use POSIX qw(:fcntl_h);
25 use English;
26 use strict;
27
28 use vars qw($query $fcnfile $query_dir $fcntext %handlers
29 $response $errortext $location $delim $tag);
30 use vars qw($authorized_uid);
31
32
41 # this handles all form data for us...
42 $query = CGI->new;
108 # this is used to delimit substitutions in the body of various containers.
109 # it can be changed with the <replace> container.
110 $delim = "%";
111
112 # this is the main loop. find a tag, and call the appropriate handler
113 # if there is one.
114 while( $fcntext =~ m/<(\w+)(.*?)>/gsci ) {
115 $tag = lc($1);
116 $handlers{$tag} && &{$handlers{$tag}}($tag, $2);
117 }
118
119 # finish up... if we are to redirect the user, send a Location header,
120 # otherwise, send the response as text/html.
121 if($location) {
122 print("Location: $location\r\n\r\n");
123 } else {
124 print("Content-type: text/html\r\n\r\n");
125 print $response, "\n";
126 }
127
128 exit(0);
129
130
131 # GENERIC SUBROUTINES
132
133 # string getbody( string $tagname );
134 # this is called to retrieve the body of a container by the handler
135 # for that container. $tagname is the name of the container, and is
136 # used to find the closing tag.
137 sub getbody {
138 my($tagname) = shift;
139 if( $fcntext =~ m/\G(.*?)(<\/$tagname>)/gsci ) {
140 return $1;
141 }
142
143 return "";
144
145 }
146
147 # string substitute( string $text );
148 # this is used to replace all occurences of "%var%" in $text with
149 # the value of the submitted form variable "var".
150 sub substitute {
151 my($text) = $_[0];
152
153 $text =~ s/$delim(\w+)$delim/ $query->param($1) /ge;
154 return $text;
155
156 }
[edited by: jatar_k at 5:04 pm (utc) on Oct. 30, 2007]
[edit reason] reduced code dump [/edit]
On a side note, don't use the -w flag. Use the warnings pragma:
[perl]use warnings;[/perl]
then you can do this as needed in the script:
[perl]
sub my_function {
no warnings;
code here
}
[/perl]
which turns off warnings only for that block of code.
Avoid using this module:
[perl]use English; [/perl]
it can slow down your perl scripts considerably. See the English module docs for details:
[edited by: jatar_k at 6:03 pm (utc) on Oct. 30, 2007]
[perldoc.perl.org...]
I have used #!/usr/bin/perl -T
as suggested and still get the same warnings.
______________
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
[Tue Oct 30 16:30:12 2007] formication.pl: Use of uninitialized value in substitution iterator at formication.pl line 153.
Content-type: text/html