Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Split web page, first 30 lines only -- :content_cb trickby Discipulus (Canon) |
on Feb 28, 2017 at 09:08 UTC ( [id://1183107]=note: print w/replies, xml ) | Need Help?? |
Hello wrkrbeee, you get answers to solve your problem, but hoping not confusing you, i propose another solution (in Perl there is always!). You are not forced to read the entire web page (can be an expensive task for big number of pages). Infact get from LWP::UserAgent get the whole content unless you instruct it to behaves differently. You can specify a content_cb ie a callback to invoke for every chunk the agent retrieve from the remote server. This bypass your need to have the 30 lines logic applied for every whole page you get. Look at the docs of LWP::UserAgent, at this post by master zentara and at the following working example to get an idea of what i mean
HtH L*
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
In Section
Seekers of Perl Wisdom
|
|