App-wdq

 view release on metacpan or  search on metacpan

script/wdq  view on Meta::CPAN


    return $sparql
      ? ( $query, [ map { $_->name } @{ $sparql->parsed->{variables} } ] )
      : ($query);
}

sub http_get {
    my ( $url, %query ) = @_;

    if ( $OPT{response} ) {
        local ( @ARGV, $/ ) = $OPT{response};
        return <>;
    }

    require HTTP::Tiny;
    my $http = HTTP::Tiny->new(
        default_headers => { agent => "wdq/$VERSION" },
        timeout         => 30,
    );

    $query{format} = 'json';

t/bin.t  view on Meta::CPAN

use v5.14;
use Test::More;
use Test::Output;

my $exit;
sub wdq { system($^X, 'script/wdq', @_); $exit = $? >> 8 }
sub slurp { local (@ARGV,$/) = shift; <> }

foreach my $opt (qw(--help -h -?)) {
    output_like { wdq $opt } qr/^wdq /, qr/^$/, 'help';
    is $exit, 0;
}

foreach my $opt (qw(--version -V)) {
    output_like { wdq $opt } qr/^wdq \d+\.\d+\.\d+/, qr/^$/, 'version';
    is $exit, 0;
}

t/query.t  view on Meta::CPAN

use v5.14;
use Test::More;
use Test::Output;

sub wdq { system( $^X, 'script/wdq', '-n', @_ ) }
sub slurp { local (@ARGV,$/) = shift; <> }

my $sparql = <<SPARQL;
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT * WHERE {
    ?c wdt:P361 wd:Q544 .
}
SPARQL

foreach my $query (

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.421 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )