File: simple-example.pl

package info (click to toggle)
libhtml-embedded-turtle-perl 0.404-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 348 kB
  • sloc: perl: 3,090; makefile: 7; sh: 1
file content (31 lines) | stat: -rw-r--r-- 892 bytes parent folder | download | duplicates (3)
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
use 5.010;
use strict;

use HTML::Embedded::Turtle 0.200;
use Data::Dumper;

my $het = HTML::Embedded::Turtle->new(<<'MARKUP', 'http://example.net/');
	<title property="http://purl.org/dc/terms/title">Test</title>
	<link rel=meta href="#endorsed">
	<script language=Turtle>
		@prefix foaf: <http://xmlns.com/foaf/0.1/> .
		[] a foaf:Person ; foaf:name "Joe Bloggs" .
	</script>
	<script type="text/turtle" id=endorsed>
		@prefix foaf: <http://xmlns.com/foaf/0.1/> .
		[] a foaf:Person ; foaf:name "Alice Smith" .
	</script>
	<script type="TEXT/TURTLE" id=unendorsed>
		@prefix foaf: <http://xmlns.com/foaf/0.1/> .
		[] a foaf:Person ; foaf:name "Bob Smith" .
	</script>
	<p>Hello</p>
MARKUP

my $iter = $het->union_graph->get_statements(undef, undef, undef, undef);
while (my $st = $iter->next)
{
	say $st->as_string;
}
say "############################";
say Dumper([ $het->endorsements ]);