On Mon, 09 Jan 2006 23:54:29 +0530, Ankur Gupta wrote:
> I am writing a LWP program.
> I need to login to 10 different sites and extract information out of them..
> Each site has its own username/password.
> 
> I am writing a common module which will do the job of logging in.
> I am doing all sorts of error catching such as whether internet is up
> or not, the url is correct or not, etc. I also need to make sure the
> login was successful.
> But I am not sure how to do that. The status code returned is "200 OK"
> which is true.
> The resulting page has the string "Invalid login" which I can grep for.
> But 10 different sites would have differnt "invalid login" messages.

Data driven programming.  Make a hash with keys being the sites you login
to, values being regexes to match for success (or failure), or coderefs of
subs that will figure it out when passed the content.

And use WWW::Mechanize instead, it'll be easier.

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to