lient::VERSION = '0.71';
}
#ABSTRACT: SeeAlso Linkserver Protocol Client
use Carp qw(croak);
use JSON::XS '2.0' ;
use LWP::Simple qw(get);
use URI '1.35';
use Data::Validate::URI qw(is_web_uri);
use
my $url = $self->queryURL( $identifier );
my $json = get($url);
if (defined $json) {
return SeeAlso::Response->fromJSON( $json ); # may also croak
} else {
croak("Fail
1
=head1 SYNOPSIS
$response = seealso_request ( $baseurl, $identifier );
print $response->toJSON() . "\n" if ($response);
$client = SeeAlso::Client->new( $baseurl, ShortName => "myClient" );
nse;
{
$SeeAlso::Response::VERSION = '0.71';
}
#ABSTRACT: SeeAlso Simple Response
use JSON::XS qw(encode_json);
use Data::Validate::URI qw(is_uri);
use Text::CSV;
use SeeAlso::Identifier;
use Carp;
);
}
sub uris {
my $self = shift;
return @{ $self->{uris} };
}
sub toJSON {
my ($self, $callback, $json) = @_;
my $response = [
$self->{query}->as_string,
$self->{
return _JSON( $response, $callback, $json );
}
sub as_string {
return $_[0]->toJSON;
}
sub fromJSON {
my ($self, $jsonstring) = @_;
my $json = JSON::XS->new->decode($jsonstring);
}
sub load_config {
my $file = shift;
open(my $fh, "<", $file);
my $config = eval { JSON->new->relaxed->utf8->decode(join('',<$fh>)); };
close $fh;
return $config || { };
}
sub
};
};
} elsif ( $file =~ /\.json$/ ) {
eval {
open(my $fh, "<", $file);
my $config = JSON->new->relaxed->utf8->decode(join('',<$fh>));
=head1 INTERNAL FUNCTIONS
=head2 load_config ( $filename )
Load a configuration file (relaxed JSON format) and return a hash reference.
On error the hash reference is empty.
=head2 expand_from_co
me eq 'rdfjson') {
$self->{formats}{'rdfjson'} = {
type => "application/rdf+json",
filter => sub { return $_[0]->toRDFJSON; },
s} if ($self->{expires});
$http .= CGI::header( %headers );
$http .= $response->toJSON($callback);
} elsif ( $format eq "debug") {
$http .= CGI::header( -status => $status,
", $self->errors) . "\n" if $self->errors;
$http .= "*/\n";
$http .= $response->toJSON($callback) . "\n";
} else { # other unAPI formats
# TODO is this properly logged?