File: exampleA.pl

package info (click to toggle)
libhtml-microformats-perl 0.105-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,340 kB
  • sloc: perl: 14,121; makefile: 10; sh: 1
file content (28 lines) | stat: -rwxr-xr-x 674 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/perl

use lib "lib";
use HTML::Microformats;
use LWP::Simple qw[get];
use RDF::TrineShortcuts;

print "## " . JSON::to_json([HTML::Microformats->formats]) . "\n";

my $uri  = 'http://microformats.org/profile/hcard';
my $html = get($uri);
my $doc  = HTML::Microformats->new_document($html, $uri);
$doc->assume_all_profiles;

my @xmdp_objects = $doc->objects('XMDP');

 foreach my $xo (@xmdp_objects)
 {
   print $xo->serialise_model(
       as         => 'Turtle',
       namespaces => {
           rdfs  => 'http://www.w3.org/2000/01/rdf-schema#',
           hcard => 'http://microformats.org/profile/hcard#',
           },
       );
   print "########\n\n";
 }