jineesh135 has asked for the wisdom of the Perl Monks concerning the following question:

use strict; use warnings; use strict; use WWW::Mechanize; use HTTP::Cookies; my $outfile = "out2.htm"; my $url = "https://accounts.google.com/ServiceLogin?service=mail&passi +ve=true&rm=false&continue=http://mail.google.com/mail/&scc=1&ltmpl=de +fault&ltmplcache=2"; my $username = '<user>'; my $password = '<password>'; my $mech = WWW::Mechanize->new(); $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($url); $mech->form_id('gaia_loginform'); $mech->field("Email", $username); $mech->field("Passwd", $password); $mech->click; my $output_page = $mech->content(); print $output_page; open(OUTFILE, ">$outfile"); binmode(OUTFILE, ":utf8"); print OUTFILE "$output_page"; close(OUTFILE);

I got the above script from this website. It is really helpful for me. In the above condition it is log in to the gmail but it not says log in was success of fail.

I would like to display after execution of the above script, If log in success "Logged in successfully", or if fails it should display "Log in failed".

Please help me on the above condition.

Thank you,
Jineesh.K

Replies are listed 'Best First'.
Re: Login to the URL
by ww (Archbishop) on Jun 26, 2013 at 15:13 UTC
    What have you tried?
    Show us.

    PM exists to help you learn; not to write your code for you.

    While cargo-culting code from the Monastery is probably a common occurance, modifying it to suit your own requirements is your responsibility.

    Nonetheless, here's a hint: ascertaining where to place a snippet on this order:

    if (condition){ print "log..."; } else { print "negative login...."; }

    would worth considering.

    Come back to show us some code... and some effort... and we'll almost certainly provide more specific help.

    If you didn't program your executable by toggling in binary, it wasn't really programming!