CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
problem sorting lynx result

 



danielpcorrea
Novice

May 12, 2009, 9:17 AM

Post #1 of 6 (3460 views)
problem sorting lynx result Can't Post

Hi guys
Im taking html data using lynx text-based web browser. Anybody can help me?

Im receiving a strange error:


Code
sh: Syntax error: Unterminated quoted string 
Non apre csv. at ./chk_calk.pl line 41, <TEMP1> line 24.



Code
    my $callynx="/usr/bin/lynx -source $grafico_link|"; 
print $callynx,"\n";
open (TEMP1, $callynx);# or die "non chiama lynx...";

while (<TEMP1> ) {

if ($_ =~ m/csv/) {

$csvtmp= substr($_,38,$numcarac);
$urltmp="http://10.212.143.52/immagini/" . $csvtmp;
$wgetexec="wget " . $urltmp; #prepara download .csv
$system=system($wgetexec); #fa il download
$csvtmp=$base_add . "/" . $csvtmp;

open (TEMP2, $csvtmp) or die "Non apre csv.";

while (<TEMP2> ) {
print $_;
}
close (TEMP2);
}
}
close(TEMP1);



KevinR
Veteran


May 12, 2009, 10:11 AM

Post #2 of 6 (3457 views)
Re: [danielpcorrea] problem sorting lynx result [In reply to] Can't Post

The error appears to be coming from the shell, not perl. There are no syntax errors in the perl code you posted although it appears to be only a part of a larger perl script, so there could be an error somewhere else in the perl code.
-------------------------------------------------


alex_v2
User

May 12, 2009, 10:18 AM

Post #3 of 6 (3455 views)
Re: [KevinR] problem sorting lynx result [In reply to] Can't Post

Yeah I am with Kevin on this one. It is saying line 41 of the script is having issues. If you could highlight which line you posted is line 41 and then also give us the 24th line of the file (or the first 50 lines even) that would be great.

-Alexander


(This post was edited by alex_v2 on May 12, 2009, 10:19 AM)


danielpcorrea
Novice

May 13, 2009, 12:21 AM

Post #4 of 6 (3444 views)
Re: [danielpcorrea] problem sorting lynx result [In reply to] Can't Post

Hi guys

I think the problem is the method OPEN, because this code works fine in another cases. Im opening html codes, and probably this page has something that Open method isnt recognizing.

Thsnks for your reply
Daniel


alex_v2
User

May 13, 2009, 7:36 AM

Post #5 of 6 (3435 views)
Re: [danielpcorrea] problem sorting lynx result [In reply to] Can't Post

Open itself does not try to interpret anything though I have to say I have never used open to for a file handle and trap content from a browser.

My main experience with thing like this I actually use LWP or LWP::Simple depending on my needs. Looking around the net I have seen you post a few things on a few forums. Are you tied to using lynx for a reason? Have you looked into LWP and LWP::Simple and they don't suit your needs?

-Alexander


danielpcorrea
Novice

May 13, 2009, 8:42 AM

Post #6 of 6 (3431 views)
Re: [alex_v2] problem sorting lynx result [In reply to] Can't Post

Hi Alex and guys

I've resolved the problem with a little different solution. Now it's working fine.


Code
    my $callynx="/usr/bin/lynx -source $grafico_link|"; 
open TEMP1, $callynx or die "non chiama lynx...";

$_ = "";
$_ = <TEMP1> until /\.csv/;
$csvtmp = $_;


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives