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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.