I am trying to extract data from website using Perl API. I am using a list of URIs to get the data from the website.
Initially the problem was that if there was no data available for the URI it would die and I wanted it to skip that particular URI and go to the next available URI. I used next unless ....;
to come over this problem.
Now the problem is I am trying to extract specific data from the web by calling a specific method (called as identifiers()
) from the API. Now the data is available for the URI but the specific data (the identifiers), what I am looking for, is not available and it dies.
I tried to use eval{}
like this
eval {
for $bar ($foo->identifiers()){
#do something
};
}
When I use eval{}
I think it skips the error and moves ahead but I am not sure. Because the error it gives is Invalid content type in response:text/plain
.
Whereas I checked the URI manually, though it doesn't have the identifiers it has rest of the data. I want this to skip and move to next URI. How can I do that?
See Question&Answers more detail:os