rdf_compatible method for RDF::Trine::Statement
Toby Inkster
mail at tobyinkster.co.uk
Fri Jul 2 12:11:03 CEST 2010
On Thu, 2010-07-01 at 20:22 -0400, Gregory Williams wrote:
> Interesting. Is there a reason to prefer returning $self/undef in the
> method instead of, for example, 1/0? I'll see about applying this
> patch soon.
No particular reason. All that is important is to return a value that
evaluates to true/false. I thought $self/undef might be a way of doing
that which is useful for map. e.g.
@rdf_triples = map { $_->rdf_compatible } @triples;
But I've not really checked what returning undef from the code block
does - it probably litters @rdf_triples with undefs.
It may also be useful like:
my $safe_statement = $statement->rdf_compatible
|| RDF::Trine::Statement->new(... something ...);
# do something with $safe_statement...
--
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>
More information about the Dev
mailing list