Name: Anonymous 2013-10-20 22:56
Post a random function that you made. May be from any project you've done or make one impromptu.
Any QUALITY is allowed. No bullying!
Any QUALITY is allowed. No bullying!
use HTML::TreeBuilder::XPath;
my $tree = HTML::TreeBuilder::XPath->new;
my $host = 'http://otokei-douj.in';
my $res = $ua->request(HTTP::Request->new(GET => "$host/"));
die "$res->status_line" unless $res->is_success;
$tree->parse(decode_utf8($res->content));
my @playlist = $tree->findnodes('//ul[@class="playlist"]/li/a');
my $album_url = $playlist[rand @playlist]->attr('href');