Processing markup with Perl

Someone on IRC asked me for an example of how to parse markup using my HTML::HTML5::Microdata::Parser module. So here one is. It pulls the microdata from the page, and queries it using SPARQL.

#!/usr/bin/env perl

use HTML::HTML5::Microdata::Parser;
use LWP::Simple ‘get’;
use RDF::Query;

my $uri = “”;
my $microdata = HTML::HTML5::Microdata::Parser->new(

my $query = RDF::Query->new(<<‘SPARQL’);

PREFIX schema: <>
SELECT ?name ?page
      a schema:Person ;
      schema:name ?name ;
      schema:url ?page .


my $people = $query->execute($microdata->graph);

while (my $person = $people->next)
      “Found person: %s %s\n”,