Use of uninitialized value in numeric eq (==)

Can someone help me with this error:

[Fri Dec 11 12:07:24.417565 2015] [cgi:error] [pid 10838] [client 24.32.36.240:54536] AH01215:  [Fri Dec 11 12:07:24 2015] 
uu_upload.pl: Use of uninitialized value in numeric eq (==) at uu_upload.pl line 350.:  /home/public_html/cgi-bin/uu_upload.pl, 
referer: http://www.....com/uploader.php

Line 349 - Line 353 shows:

	# Force 'redirect_using_location' if user does not have a javascript capable browser or using embedded_upload_results
if($query->param('no_script') || $query->param('embedded_upload_results') == 1){
	$main::config->{redirect_using_js_html} = 0;
	$main::config->{redirect_using_location} = 1;
}

Any help will be appreciated.

It just means you don’t have parameters called no_script nor embedded_upload_results. You’ll need to check for the existence of the parameter before trying to access it.

Thanks Dave for your specific reply. Much appreciated.
Since I was provided this information from my web host tech support, I don’t know how to “check for the existence of the parameter before trying to access it”. Would you mind providing some more help/info, on how to do that please? Much thanks.

You can use isset(), but there has to be a better way to handle it since you should already know if you have the parameters or not as they’re getting passed to your query.

Can you post more of the relevant code?

Much thanks again. I’d be glad to provide ‘more of the relevant code’.

Here is a txt file of uu_upload.pl attached:

upload.txt (32.6 KB)

My perl is very, VERY rusty (like I haven’t used it in this century), but it looks like you need something like this:

	if(exists $query->param('no_script') || (exists $query->param('embedded_upload_results') && $query->param('embedded_upload_results')== 1)){

exists syntax can be found here: http://perldoc.perl.org/functions/exists.html

Dave thanks, rusty or not, I appreciate the effort.
I am not versed in Perl at all, just trying to get an error fixed for it’s accompanying PHP script.
Would you be interested in telling me where might be the optimal place to add that line of code in the file, please?

Line 350 (the one referenced in the original error message :wink:)

Thanks again for your guidance.
After replacing the line in question, with yours, like this:

	# Force 'redirect_using_location' if user does not have a javascript capable browser or using embedded_upload_results
if(exists $query->param('no_script') || (exists $query->param('embedded_upload_results') &&  $query->param('embedded_upload_results')== 1)){
$main::config->{redirect_using_js_html} = 0;
$main::config->{redirect_using_location} = 1;

}

I see this:
“Software error: exists argument is not a subroutine name at uu_upload.pl line 350”

Any additional suggestions/solutions will be greatly appreciated.

No clue - will need one of the perl people that can step in…@Stomme_poes?

Someone suggested this:

$query->param('embedded_upload_results')

is undefined. Using the defined function you can check if the variable is defined.

if ( defined($variable) && $variable == 10 ) {
...
}

I just don’t know how to add this to the existing code. Any additional guidance would be appreciated.

Agreed. The search I did says defined and exists basically do the same thing, but exists checks for a non-null instance of it as well

You would need to add it to that same line that errorred out, basically using something like defined($query->param(‘embedded_upload_results’)) before the value check for the variable (you’ll need to && the conditions together and wrap them in parenthesis so the two are checked as one as part of the or statement.

Thank you for your reply. Much appreciated. In regard to:

I[quote=“DaveMaxwell, post:13, topic:209728”]
using something like defined($query->param(‘embedded_upload_results’)) before the value check for the variable (you’ll need to && the conditions together and wrap them in parenthesis so the two are checked as one as part of the or statement
[/quote]

I’d like to try that, but don’t know how to put that into a workable line of code. Any additional help will be appreciated. Thanks

It should be very similar to what I posted earlier (code is code, it’s just a matter of syntax)

if(defined($query->param('no_script')) || (defined($query->param('embedded_upload_results')) && $query->param('embedded_upload_results') == 1)) {

Thanks for the help. That created a 500 Internal server error, but I appreciate your help.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.