#!/opt/dev/perl/bin/perl -w # Example: hotjobs.pl username [password] use strict; use warnings; use WWW::Mechanize; use Pod::Usage; use Crypt::SSLeay; # required for Yahoo login my ($username, $pass) = @ARGV; my $verbose = 1; if (!defined $username) { print "Please provide your Yahoo! username.\n"; exit(-1); } if (!defined $pass) { print "Please enter your password:"; system('/bin/stty', '-echo'); # Disable echoing $pass = ; system('/bin/stty', 'echo'); # Turn it back on chomp($pass); print "\n"; } my $agent = WWW::Mechanize->new(autocheck => 1); my @strs; # used to save reply message which may be very long my $resumetitle; $agent->get('http://hotjobs.yahoo.com/'); # Go to "My Resumes" $agent->follow_link( url_regex => qr/resume-manager.html/i); # Need to login $agent->form_name("login_form"); $agent->field("login", $username); $agent->field("passwd", $pass); print "Logging in...\n" if $verbose; # this will take the default action. $agent->submit(); # Follow redirection print "Redirecting...\n" if $verbose; $agent->follow_link( url_regex => qr/redir/i); # Follow the first link to edit searchable resume print "Looking for searchable resume...\n" if $verbose; $agent->follow_link( url_regex => qr/text_editor.html/i, n => 1); # We only need to modify title print "Start editing resume...\n" if $verbose; $agent->form_name("mainform"); $resumetitle = $agent->field("resumename"); if ($resumetitle =~ /\s+$/) { $resumetitle =~ s/\s+$//; } else { $resumetitle .= " "; } $agent->field("resumename", $resumetitle); print "Making changes to resume...\n" if $verbose; $agent->click_button(name => "submitchanges", value => "Save and Exit"); print "Finished updating resume!\n";