Is there a way to extract HTML page title using Perl? I know it can be passed as a hidden variable during form submit and then retrieved in Perl that way but I was wondering if
I would use pQuery. It works just like jQuery.
You can say:
use pQuery;
my $page = pQuery("http://google.com/");
my $title = $page->find('title');
say "The title is: ", $title->html;
Replacing stuff is similar:
$title->html('New Title');
say "The entirety of google.com with my new title is: ", $page->html;
You can pass an HTML string to the pQuery
constructor, which it sounds like you want to do.
Finally, if you want to use arbitrary HTML as a "template", and then "refine" that with Perl commands, you want to use Template::Refine.