Skip to content

Instantly share code, notes, and snippets.

@phillipadsmith
Created March 10, 2013 22:02
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/f5416dfd0e90ee4b4775 to your computer and use it in GitHub Desktop.
Save phillipadsmith/f5416dfd0e90ee4b4775 to your computer and use it in GitHub Desktop.
# Works, i.e., the body is there, but the HTML is a mess:
perl -Mojo -E 'say g("foxnews.com")->body'
# Doesn't work: not able to find the title tag
perl -Mojo -E 'say g("foxnews.com")->dom->at("title")->text'
Can't call method "text" on an undefined value at -e line 1.
@phillipadsmith
Copy link
Author

perl -Mojo -E 'say g("foxnews.com")->tap(sub { shift->headers->content_type("text/html") })->dom->at("title")->text'

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