The code snippet I got a couple of days ago was really great, but I still have some
problem with it. It generates an error:
my $response = do {
my $handle = IO::File->new(">tvschedule.html");
$ua->request(HTTP::Request->new(GET=>$url),sub{ print $handle $_[0];
$p->parse($_[0]);});
}
# Expand all image URLs to absolute ones
my $base = $response->base; ##### this is line 34
...
...
This gives the following error:
syntax error at /Users/ivan/bin/fmn line 34, near "my "
Execution of /Users/ivan/bin/filmnet aborted due to compilation errors.
If I on the other hand replace the "do" block with:
$response = $ua->request(HTTP::Request->new(GET => $url), sub {$p->parse($_[0])});
then the program runs fine.
Is there a difference in the $response returned by these two cases?
Ivan