Skip to content

Instantly share code, notes, and snippets.

@phillipadsmith
Created March 2, 2013 04:18
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 phillipadsmith/91a7999ae9b9233405ac to your computer and use it in GitHub Desktop.
Save phillipadsmith/91a7999ae9b9233405ac to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
$ua = $ua->max_redirects(10);
# This doesn't work:
my $r = $ua->get('http://vine.co/v/bXmx6Pth79P')->res;
print $r->dom->html->head->title->text;
# Returns:
# Can't locate object method "html" via package "Mojo::DOM" at /Users/phillipadsmith/Downloads/mojo_test.pl line 11.
# This *does* work (wtf?)
# perl -Mojo -E 'say g("http://vine.co/v/bXmx6Pth79P")->dom->at("title")->text'
# Dave Stanton's post on Vine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment