in reply to Re: Parsing CC licenses
in thread Parsing CC licenses

I frankly have no starting idea about how to deal with the triples.. that is what I thought this module would do. Otherwise why even bother with this module.. just use XML::Parser or something similar and roll my own, no?

In any case, the Pod of the module also says

In place of either or both functions you can use the string 'print' which sets the callback to a built-in function which prints the triples to STDOUT as Turtle. Either or both can be set to undef, in which case, no callback is called when a triple is found.

So, that is exactly what I did, but got nothing, nada, zilch.

The relevant code in the module is

if (lc($_[$n]) eq 'print') { $this->{'sub'}->[$n] = ($n==0 ? \&_print0 : \&_print1); +} .. a few lines down .. sub _print0 # Prints a Turtle triple. { my $this = shift; my $element = shift; my $subject = shift; my $pred = shift; my $object = shift; printf("# Triple on element %s.\n", $element->nodePath); printf("%s %s %s .\n", ($subject =~ /^_:/ ? $subject : "<$subject>"), "<$pred>", ($object =~ /^_:/ ? $object : "<$object>")); } .. and so on ..

--

when small people start casting long shadows, it is time to go to bed