Errors viewing perl editor



Hello,

Please i need some assistance running a perl script, i obtained a Google API key, installed a a perl editor to run the program, The server for the program went down,so this is the only way to access the application, however i experience errors when debugging the program on my computer

The errors are:

Useless use of a constant in void context at Untitled line 12 "SOAP::Lite" ;
Use of uninitialized value in concatenation(.) or string at (eval 8) line 15 " use List ::Until qw(max min)" ;

Use of uninitialized value in concatenatiom(.) or string at Untitled line 62 " $x = '+" ' . $query->param('term1') . ' " " ;

Use of uninitialized value in concatenatiom(.) or string at Untitled line 63 " $x = '+" ' . $query->param('term2') . ' " " ;

Can`t locate object method "service" via package "SOAP::Lite" (perhaps ypu forgot to load "SOAP::Lite"?) at Untitled line 30.

This are the errors displayed on the browser.

This is the source code for the program :

#!"C:Program Filesxamppperlinperl.exe"
# ngd-calculator.cgi
#
# wjt
# http://history.uwo.ca/faculty/turkel/
#
# 5 aug 2006

use SOAP::Lite;
use CGI;
use POSIX qw(log10);
use List::Util qw(max min);

# Google API developer's key
my $google_key = '';

# Google WSDL
my $google_wsdl = "http://api.google.com/GoogleSearch.wsdl";
# my $google_wsdl = "./GoogleSearch.wsdl";

# start, maxResults, filter, restrict, safeSearch, lr, ie, oe
my @params = (0, 10, 0, '', 0, '', 'utf-8', 'utf-8');

# Do Google search and return count
sub do_search {
unshift (@params, ($google_key, $_[0]));
my $result =
SOAP::Lite
-> service($google_wsdl)
-> doGoogleSearch(@params);
shift @params;
shift @params;
return $result->{estimatedTotalResultsCount};
}

# Create the search page
$query = new CGI;
print $query->header;
print $query->start_html('NGD Calculator');
print "

Normalized Google Distance (NGD) Calculator

";

print '

';
print 'For information about NGD see Rudi Cilibrasi and Paul Vitanyi, "';
print '';
print 'Automatic Meaning Discovery Using Google
."';
print '

';

# Print the search box form
print $query->startform;
print 'Enter term 1 ',$query->textfield('term1');
print '
';
print 'Enter term 2 ',$query->textfield('term2');
print '
';
print $query->submit('form_1','Calculate');
print $query->endform;
print '
';

$x = ''; $y = ''; $xy = '';
$x = '+"' . $query->param('term1') . '"';
$y = '+"' . $query->param('term2') . '"';
$xy = $x . " " . $y;

$fx = 1; $fy = 1; $fxy = 1;
$logfx = 0; $logfy = 0; $logfxy = 0; $logm = 0;
$maxlogfxy = 0; $minlogfxy = 0;
$ngd = 0;

# Best guess as of Jan 2006
$m = 11828505634;

if ($x && $y) {

# Determine frequencies
$fx = do_search( $x );
$fy = do_search( $y );
$fxy = do_search( $xy );

# Determine logarithms
$logm = log10( $m );
$logfx = log10( $fx );
$logfy = log10( $fy );
$logfxy = log10( $fxy );

# Determine max and min
@fxy = ($logfx, $logfy);
$maxlogfxy = max @fxy;
$minlogfxy = min @fxy;

# Calculate NGD
$ngd = ($maxlogfxy - $logfxy) / ($logm - $minlogfxy);

print 'NGD(x,y) = ' . $ngd . '

';

print 'Term 1: ' . $x . '
';
print 'f(x) = ' . $fx . '
';
print 'log f(x) = ' . $logfx . '

';

print 'Term 2: ' . $y . '
';
print 'f(y) = ' . $fy . '
';
print 'log f(y) = ' . $logfy . '

';

# print 'max(log f(x),log f(y)) = ' . $maxlogfxy . '
';
# print 'min(log f(x),log f(y)) = ' . $minlogfxy . '

';

print 'Intersection: ' . $xy . '
';
print 'f(x,y) = ' . $fxy . '
';
print 'log f(x,y) = ' . $logfxy . '

';

print 'M: ' . $m . '
';
print 'log M: ' . $logm . '
';
}

print qq{

Digital History at Western};
print $query->end_html;

Please any assistance is highly appreciated, because i am meant to use the application for a research presentation soon. Please

Thank you
Spanish

Comments

  • It works for me when run on a linux box...at least the form loads correctly in cgi with no errors, I don't know about the rest of what you are doing. Are you pointing to your correct perl location and do you have the module SOAP::Lite installed correctly? What version perl do you have ... perl -v .
  • I am running on windows Xp and the version is DZSoft.Perl.Editor. v5.8.3.7-iN and OptiPerl-5.4 Trial, i have installed the SOAP-Lite in the directory.
    just like you mentioned is to display the user interfaces with the boxes in it(forms)and perform calculation between the terms
    "Enter term 1 and Enter term 2, using the calculate button.
    I ran the program and i got the forms but the calculation does not return any value, when the calculate button is clicked

    Thank you

    Spanish
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories