powerhouse has asked for the wisdom of the Perl Monks concerning the following question:
Use of uninitialized value in eval "string" at /path_to/req/readin_pag +evars.cgi line 10, <STDIN> line 47. Use of uninitialized value in eval "string" at /path_to/req/readin_pag +evars.cgi line 10, <STDIN> line 47. Use of uninitialized value in eval "string" at /path_to/req/readin_pag +evars.cgi line 10, <STDIN> line 47. Use of uninitialized value in substitution iterator at /path_to/req/re +adin_pagevars.cgi line 10, <STDIN> line 47. Use of uninitialized value in eval "string" at /path_to/req/readin_pag +evars.cgi line 10, <STDIN> line 47. Use of uninitialized value in eval "string" at /path_to/req/readin_pag +evars.cgi line 10, <STDIN> line 47.
sub Get_Page_Vars { my ($temp_vars,$type) = @_; my ($code1, $code2, $_do_code, $syscode1, $syscode2); $sth = $dbh->prepare (qq{ SELECT `name`,`value`,`add_name` FROM `p +age_vars` WHERE `type` = ? OR `type2` = ? ORDER BY add_name,id,d}); $sth->execute($type,$type); while(my ($db_name,$content,$_add_name) = $sth->fetchrow_array()) +{ $content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ eval($temp_vars{$1}) /g +e; $content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ $temp_vars{eval($1)} /g +e; $content =~ s/\<templ_var ([a-zA-Z0-9\{\'\}_]+)\>/ eval ($vars +{$1}) /ge; $content =~ s/\<templ_var ([a-zA-Z0-9\{\'\}_]+)\>/ $vars{eval( +$1)} /ge; $content =~ s/\<templ_var ([a-zA-Z0-9\{\'\}_]+)\>/ eval ($temp +_vars{$1}) /ge; $content =~ s/\<templ_var ([a-zA-Z0-9\{\'\}_]+)\>/ $temp_vars{ +eval($1)} /ge; $content =~ s/\<templ_var ([a-zA-Z0-9\{\'\}_]+)\>/ eval ($1) / +ge; $content =~ s/{{([a-zA-Z0-9\{\'\}_]+)}}/ eval($vars{$1}) /ge; $content =~ s/{{([a-zA-Z0-9\{\'\}_]+)}}/ $vars{eval($1)} /ge; $content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ eval($vars{$1}) /ge; $content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ $vars{eval($1)} /ge; $content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ eval($1) /ge; if ($content && ($content =~ /<code>/i && $content =~ /<\/code +>/i)) { while($content =~ /<code>/i && $content =~ /<\/code>/i) { my ($code1,$code2,$_do_code); ($content,$code1) = split /<code>/, $content, 2; ($code2,$ocontent) = split /<\/code>/, $code1, 2; $_do_code = eval($code2) if $_do_code && $_do_code ne +""; $content = $content . $_do_code . $ocontent; } } if ($content && ($content =~ /<syscode>/i && $content =~ /<\/s +yscode>/i)) { while($content =~ /<syscode>/i && $content =~ /<\/syscode> +/i) { my ($syscode1,$syscode2); ($content,$syscode1) = split /<syscode>/i, $content, 2 +; ($syscode2,$ocontent) = split /<\/syscode>/i, $syscode +1, 2; eval($syscode2) if $syscode2 && $syscode2 ne ""; $content = $content . $ocontent; } } if ($_add_name) { $content = qq~<!--Start $db_name-->$content<!--End $db_nam +e-->~; } $temp_vars{$db_name} = $content; } $sth->finish(); return(%temp_vars); }
Retitled by g0n from 'Positive Criticism Requested, please.'.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with 'Use of uninitialized value...' error in DB code
by Zaxo (Archbishop) on Sep 03, 2005 at 05:01 UTC | |
|
Re: Help with 'Use of uninitialized value...' error in DB code
by davidrw (Prior) on Sep 03, 2005 at 13:54 UTC | |
|
Re: Help with 'Use of uninitialized value...' error in DB code
by CountZero (Bishop) on Sep 03, 2005 at 08:15 UTC | |
by powerhouse (Friar) on Sep 03, 2005 at 12:56 UTC | |
by davidrw (Prior) on Sep 03, 2005 at 13:40 UTC | |
|
Re: Help with 'Use of uninitialized value...' error in DB code
by Errto (Vicar) on Sep 03, 2005 at 21:50 UTC |