Ihave spent too long struggling with a case of my computer seems to give semi random results printing a string combination value to test that it is right.
One thing may be that perl is not compiled in a compatible way on my computer. First, could someone try runing this script to see if the print statements make different presentations of a string variable that all are consistent? I made substrings of 30 and 40 chars long and printed them consecutively so they should look like the longer line above, but as if word wrapped shorter and shorter. thanks John perl script ============ #!/usr/local/bin/perl -Tw use strict; $|++; # Program to GET via HTTP from traviscad.org free taxed company listings # and generate a list of interesting co's (getlist), by name. # and sbs.dnb.com site free company listings # from getlist file used along with knowing the form details to GET in advance # (used opera and copied url GET going out real quick before answer arrived) # and maybe later parse html to text and update .csv # job search data files at the same time. # Created by John Griessen 8/26/2001 # post a db query using Get, since all on the one url line. # if title is Company Info{getCompanyRecord} or else, # if title is Search Results # then extract links like: (http://sbs.dnb.com/compInfo.asp?callback=yes&compName=* ) # even if they are in html as: <A href="compInfo.asp?callback=yes&compName=* use LWP::UserAgent; # send an HTTP GET request to the specified url use HTTP::Cookies; #debug text out is ./htmtxt.txt open(HTMERR, "> ./dnb/htmerr.txt") || die "Could not open htmtxt.txt : $!\nStopped"; open(CSVOUT, "> ./dnb/csvout.txt") || die "Could not open csvout.txt : $!\nStopped"; # open(CSVOUTPLUS, "> ./dnb/csvoutplus.txt") || die "Could not open csvout.txt : $!\nStopped"; open(HTMTXT, "> ./dnb/htmtxt.txt") || die "Could not open /perl/jg/htmtxt.txt : $!\nStopped"; my ($search_city, $search_state, $co_list); my @co_name; if (defined($ARGV[0])) {$search_city = shift @ARGV; } else {die "Usage: \$search_city, \$search_state, \$co_list co_list defaults to dnb/co_list.txt: $!\nStopped"; } if (defined($ARGV[0])) {$search_state = shift @ARGV; } else {die "Usage \$search_city, \$search_state, \$co_list co_list defaults to dnb/co_list.txt: $!\nStopped"; } $co_list = "dnb/co_list.txt"; if (defined($ARGV[0])) {$co_list = shift @ARGV; } print "co_list= " , $co_list , "\n"; open(CO_LIST, "< $co_list") || die "Could not open $co_list : $!\nStopped"; # get argument file full of company names into an array @co_name while(<CO_LIST>){push @co_name, $_; } close(CO_LIST) || die "Could not close dnb/co_list.txt : $!\nStopped"; # By default LWP ignores cookies provided by the servers it visits. # LWP can be forced to collect cookies and respond to cookie # requests if you set up a cookie jar. my $cookies = "/home/john/.kde/share/apps/kcookiejar/cibolo.cookie.jar"; print "cookie jar is: " , $cookies, "\n"; my ($ua, $res, $chunk); $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(file => $cookies, autosave => 1)); $ua->agent('Mozilla 8.0/0.1 '); # pretend we are browser my ($n, $search_company_name, $result); my ($formfill, $formfill1, $formfill2, $formfill3); print "formfill int value = ", $formfill, "\n"; NAMES: while ($co_name[0]) { $n = shift @co_name; chomp $n; $search_company_name = $n; $search_company_name =~ s/ /\%20/g ; # example url. http://sbs.dnb.com/lookup.asp?country=US&name=cygnal%20integrated%20products&st=TX&city=austin # cat together a url from command line args for a specific company GET. $formfill3 = join "", "http://sbs.dnb.com/lookup.asp?country=US&name=", "$search_company_name"; $formfill2 = join "", "&st=", "$search_state", "&city=", "$search_city"; $formfill1 = join "XX", $formfill3, $formfill2; print STDOUT "co name = ", $search_company_name, "\n"; print STDOUT "formfill3 = ", $formfill3, "\n"; print STDOUT "formfill2 3x = ", $formfill2, $formfill2, $formfill2, "\n"; print STDOUT "formfill1 follows ", "\n"; print STDOUT $formfill1, "\n"; print STDOUT "formfill1 by 40 chars follows ", "\n"; $n = substr($formfill1, 0, 40), "\n"; print STDOUT $n, "\n"; $n = substr($formfill1, 40, 40), "\n"; print STDOUT $n, "\n"; $n = substr($formfill1, 80, 40), "\n"; print STDOUT $n, "\n"; print "formfill1 by 30 chars follows ", "\n"; $n = substr($formfill1, 0, 30), "\n"; print STDOUT $n, "\n"; $n = substr($formfill1, 30, 30), "\n"; print STDOUT $n, "\n"; $n = substr($formfill1, 60, 30), "\n"; print STDOUT $n, "\n"; #print substr($formfill1, 90), "\n"; # $chunk = SendHTTPGETRequest ($formfill); # put ways to use response here! #print HTMTXT "co_list chunk =", $chunk, "\n"; print "while block last line", "\n"; } ========================================== end of perl program the output I get: =================== ./dnb2texdebug.pl Austin TX Useless use of a constant in void context at ./dnb2texdebug.pl line 82. Useless use of a constant in void context at ./dnb2texdebug.pl line 84. Useless use of a constant in void context at ./dnb2texdebug.pl line 86. Useless use of a constant in void context at ./dnb2texdebug.pl line 89. Useless use of a constant in void context at ./dnb2texdebug.pl line 91. Useless use of a constant in void context at ./dnb2texdebug.pl line 93. Name "main::CSVOUT" used only once: possible typo at ./dnb2texdebug.pl line 25. Name "main::HTMERR" used only once: possible typo at ./dnb2texdebug.pl line 24. Name "main::HTMTXT" used only once: possible typo at ./dnb2texdebug.pl line 27. co_list= dnb/co_list.txt cookie jar is: /home/john/.kde/share/apps/kcookiejar/cibolo.cookie.jar Use of uninitialized value in print at ./dnb2texdebug.pl line 64. formfill int value = co name = S%20I%20Diamond formfill3 = http://sbs.dnb.com/lookup.asp?country=US&name=S%20I%20Diamond formfill2 3x = &st=TX&city=Austin&st=TX&city=Austin&st=TX&city=Austin formfill1 follows XX&st=TX&city=Austinookup.asp?country=US&name=S%20I%20Diamond formfill1 by 40 chars follows http://sbs.dnb.com/lookup.asp?country=US XX&st=TX&city=Austond in formfill1 by 30 chars follows http://sbs.dnb.com/lookup.asp? country=US&name=S%20I%20Diamon XX&st=TX&city=Austin while block last line =================== end of my output my perl and gcc compiler: [john@carbide perl]$ perl -v This is perl, v5.6.1 built for i686-linux I compiled it, and that used a 2.4.9 kernel required version of gcc: [root@carbide /]# find -name gcc* ../usr/local/rpm-pkg/gcc-2.96-85.i386.rpm ../usr/share/doc/gcc-2.96 [root@carbide /]# gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) Could I have a i386 i686 difference in the way some -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]