Skip to content

Instantly share code, notes, and snippets.

@jamadam
Last active January 27, 2016 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamadam/5d22fc50688d89b1bd3d to your computer and use it in GitHub Desktop.
Save jamadam/5d22fc50688d89b1bd3d to your computer and use it in GitHub Desktop.
original code
# login
my $tx1 = $ua->get($urlbase->clone->path('/admin/login'));
my $tx2 = post_form_by_dom($tx1->res->dom->at('#form'), $ua, $urlbase, {
'_method' => 'POST',
'data[AdminUser][username]' => 'test',
'data[AdminUser][password]' => 'test',
});
$tx2->res->dom->find('.container td a')->each(sub($a, $) {
my $url = $urlbase->clone->parse($a->attr('href'));
my $size = $a->text();
my $expected = $size > 100 ? 100 : $size;
my $tx3 = $ua->get($url);
});
@jamadam
Copy link
Author

jamadam commented Jan 27, 2016

simplified a little.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment