/usr/share/doc/libhtml-microformats-perl/examples/misc/exampleC.pl is in libhtml-microformats-perl 0.105-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | use HTML::Microformats;
use LWP::Simple qw[get];
use RDF::Query;
my $page = 'http://twitter.com/t' || 'http://tantek.com/';
my $graph = HTML::Microformats
->new_document(get($page), $page)
->assume_all_profiles
->parse_microformats
->model;
my $query = RDF::Query->new(<<SPARQL);
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?friendname ?friendpage
WHERE {
<$page> ?p ?friendpage .
?person foaf:name ?friendname ;
foaf:page ?friendpage .
FILTER (
isURI(?friendpage)
&& isLiteral(?friendname)
&& regex(str(?p), "^http://vocab.sindice.com/xfn#(.+)-hyperlink")
)
}
SPARQL
my $results = $query->execute($graph);
while (my $result = $results->next)
{
printf("%s <%s>\n",
$result->{friendname}->literal_value,
$result->{friendpage}->uri,
);
}
|