/usr/share/perl5/RDF/Query/VariableBindings.pm is in librdf-query-perl 2.918-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | # RDF::Query::VariableBindings
# -----------------------------------------------------------------------------
=head1 NAME
RDF::Query::VariableBindings - Variable bindings
=head1 VERSION
This document describes RDF::Query::VariableBindings version 2.918.
=head1 METHODS
Beyond the methods documented below, this class inherits methods from the
L<RDF::Trine::VariableBindings> class.
=over 4
=cut
package RDF::Query::VariableBindings;
use strict;
use warnings;
use base qw(RDF::Trine::VariableBindings);
use overload '""' => sub { $_[0]->as_string },
'bool' => sub { return 1 };
use Scalar::Util qw(blessed refaddr);
######################################################################
our ($VERSION);
BEGIN {
$VERSION = '2.918';
}
######################################################################
=item C<< new ( \%bindings ) >>
=cut
sub new {
my $class = shift;
my $bindings = shift || {};
my $data = { %$bindings };
foreach my $k (keys %$data) {
my $node = $data->{$k};
if (ref($node) and not($node->isa('RDF::Query::Node'))) {
$data->{$k} = RDF::Query::Node->from_trine( $node );
}
}
my $self = $class->SUPER::new( $data );
return $self;
}
=item C<< sse ( \%context, $indent ) >>
=cut
sub sse {
my $self = shift;
my $context = shift;
my $indent = shift;
my $more = ' ';
my @keys = sort keys %$self;
return sprintf('(row %s)', CORE::join(' ', map { '[' . CORE::join(' ', '?' . $_, ($self->{$_}) ? $self->{$_}->as_string : ()) . ']' } (@keys)));
}
=item C<< explain >>
Returns a string serialization of the variable bindings appropriate for display
on the command line.
=cut
sub explain {
my $self = shift;
my $s = shift;
my $count = shift;
my $indent = $s x $count;
my $string = "${indent}Variable Bindings\n";
my @keys = sort keys %$self;
foreach my $k (@keys) {
$string .= "${indent}${s}$k: " . $self->{$k}->as_string . "\n";
}
return $string;
}
=item C<< as_hash >>
Returns the variable bindings as a nested set of plain data structures (no objects).
=cut
sub as_hash {
my $self = shift;
my $context = shift;
my @keys = sort keys %$self;
return { type => 'bindings', bindings => { map { $_ => $self->{$_}->as_hash($context) } @keys } };
}
1;
__END__
=back
=head1 AUTHOR
Gregory Todd Williams <gwilliams@cpan.org>
=cut
|