Hello! Help me please!
I compile the fellowing perl program and meet a problem:use HTTP::Request;use LWP::UserAgent;$content=getContent('http://127.0.0.1/index.htm');@html=split(/\n/,$content); for(@html){ do { $2 and push(@link,$2); }while m { \s*A\s+HRE\s*=\s*(['''])(.*?)\l\s* }gsix; print All links in this page:\n; for(@link) { print $_,\n; } print Visit all links in this page: \n; for(@link) { if(!(m~^http://~)) { $url=''.$_">http://127.0.0.1/'.$_ ; $content=getContent($url); printEOF; content of this $url is: $content EOF } if((m~^http://127.0.0.1~)or(m~^http://localhost~)) { $conten=getContent($_); printEOF; content of this $url is: $content EOF } }}sub getContent { my $url=""> my $ua=new LWP::UserAgent(); my $request=new HTTP::Request('GET',$url); my $response=$ua-request($request); my $content=$response-content; return $content;}When I compile it the compiler show me:Can't find string terminator EOF anywhere before EOF at robot.pl line 84.##(red as I marked).##Please tell how to..? thanks a lot! ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Hello! Help me please!
Hi Try changing your code to something formatted this way: FROM: if(!(m~^http://~)) { $url='http://127.0.0.1/'.$_ ; $content=getContent($url); printEOF; content of this $url is: $content EOF } to: if(!(m~^http://~)) { $url='http://127.0.0.1/'.$_ ; $content=getContent($url); print EOF; content of this $url is: $content EOF } I tried it works for me. Hope this helps. Bruno Georges Glencore International AG Tel. +41 41 709 3204 Fax +41 41 709 3000 |-+- | | gao perlone [EMAIL PROTECTED]| | | Sent by: | | | [EMAIL PROTECTED]| | | veState.com | | | | | | | | | 05.01.06 13:13| | | | |-+- --| | | |To: Perl-Win32-Users@listserv.ActiveState.com | |cc: | |Subject: Hello! Help me please! | | | |Distribute: | |Personal? |---| | || [ ] x | | ||---| | | | --| I compile the fellowing perl program and meet a problem: use HTTP::Request; use LWP::UserAgent; $content=getContent('http://127.0.0.1/index.htm'); @html=split(/\n/,$content); for(@html) { do { $2 and push(@link,$2); }while m { \s*A\s+HRE\s*=\s*(['''])(.*?)\l\s* }gsix; print All links in this page:\n; for(@link) { print $_,\n; } print Visit all links in this page: \n; for(@link) { if(!(m~^http://~)) { $url='http://127.0.0.1/'.$_ ; $content=getContent($url); printEOF; content of this $url is: $content EOF } if((m~^http://127.0.0.1~)or(m~^http://localhost~)) { $conten=getContent($_); printEOF; content of this $url is: $content EOF } } } sub getContent { my $url=shift; my $ua=new LWP::UserAgent(); my $request=new HTTP::Request('GET',$url); my $response=$ua-request($request); my $content=$response-content; return $content; } When I compile it the compiler show me: Can't find string terminator EOF anywhere before EOF at robot.pl line 84.##(red as I marked).## Please tell how to..? thanks a lot!___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs LEGAL DISCLAIMER. The contents of this e-mail and any attachments are strictly confidential and they may not be used or disclosed by someone who is not a named recipient. If you have received this email in error please notify the sender by replying to this email inserting the word misdirected as the message and delete this e-mail from your system. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Hello! Help me please!
=== your code === use HTTP::Request; use LWP::UserAgent; $content=getContent('http://127.0.0.1/index.htm'); @html=split(/\n/,$content); for(@html) { do { $2 and push(@link,$2); }while m { \s*A\s+HRE\s*=\s*(['''])(.*?)\l\s* }gsix; print All links in this page:\n; for(@link) { print $_,\n; } print Visit all links in this page: \n; for(@link) { if(!(m~^http://~)) { $url='http://127.0.0.1/'.$_ ; $content=getContent($url); printEOF; content of this $url is: $content EOF } == I believe that if you inline a heredoc like that the contents of the heredoc have to be left aligned all the way to the left margin. If you find that too ugly you can factor out the heredocs into a constant and then use the constant name in the actual code. Robert ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Hello! Help me please!
Gao In a nutshell you have to wrtie the closing print string: EOF at the beginning of the line, without spaces nor tabs. Bruno Georges Glencore International AG Tel. +41 41 709 3204 Fax +41 41 709 3000 |-+- | | gao perlone [EMAIL PROTECTED]| | | Sent by: | | | [EMAIL PROTECTED]| | | veState.com | | | | | | | | | 05.01.06 13:13| | | | |-+- --| | | |To: Perl-Win32-Users@listserv.ActiveState.com | |cc: | |Subject: Hello! Help me please! | | | |Distribute: | |Personal? |---| | || [ ] x | | ||---| | | | --| I compile the fellowing perl program and meet a problem: use HTTP::Request; use LWP::UserAgent; $content=getContent('http://127.0.0.1/index.htm'); @html=split(/\n/,$content); for(@html) { do { $2 and push(@link,$2); }while m { \s*A\s+HRE\s*=\s*(['''])(.*?)\l\s* }gsix; print All links in this page:\n; for(@link) { print $_,\n; } print Visit all links in this page: \n; for(@link) { if(!(m~^http://~)) { $url='http://127.0.0.1/'.$_ ; $content=getContent($url); printEOF; content of this $url is: $content EOF } if((m~^http://127.0.0.1~)or(m~^http://localhost~)) { $conten=getContent($_); printEOF; content of this $url is: $content EOF } } } sub getContent { my $url=shift; my $ua=new LWP::UserAgent(); my $request=new HTTP::Request('GET',$url); my $response=$ua-request($request); my $content=$response-content; return $content; } When I compile it the compiler show me: Can't find string terminator EOF anywhere before EOF at robot.pl line 84.##(red as I marked).## Please tell how to..? thanks a lot!___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs LEGAL DISCLAIMER. The contents of this e-mail and any attachments are strictly confidential and they may not be used or disclosed by someone who is not a named recipient. If you have received this email in error please notify the sender by replying to this email inserting the word misdirected as the message and delete this e-mail from your system. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Hello! Help me please!
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of DZ-Jay Sent: Thursday, January 05, 2006 11:44 AM To: Hicks, Robert Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: Hello! Help me please! Hicks, Robert wrote: I believe that if you inline a heredoc like that the contents of the heredoc have to be left aligned all the way to the left margin. Not the *contents* of the heredoc, but the closing label must be the first thing on its line. This should be fine: if(!(m~^http://~)) { $url='http://127.0.0.1/'.$_; $content=getContent($url); printEOF; content of this $url is: $content EOF } If that is too ugly for you (it is for me!), then perhaps you should use a standard double-quoted string: print \ncontent of this $url is:\n$content; dZ. I think you can also rewrite the heredoc as such (with a 4 space indentation): print EOF; content of this $url is: $content EOF I've used this for some things in the past. hth, rmd ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs