view release on metacpan or search on metacpan
lib/Catmandu/Importer/MWTemplates.pm view on Meta::CPAN
if (defined $self->page) {
my $page = $self->page;
my $url = $self->site . "wiki/$page?action=raw";
my $res = $client->get($url);
if ($res->is_success) {
$text = $res->decoded_content;
} else {
die "failed to get $url";
}
} else {
# TODO: read pages from input unless page is set
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Importer/getJSON.pm view on Meta::CPAN
}
$self->time(time);
my $response = $self->client->get( $url, $self->headers );
if ( $response->is_success ) {
my $content = $response->decoded_content;
my $data = $self->json->decode($content);
$json = $self->response_hook($data);
}
else {
warn "request failed: $url\n" if $self->warn;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/MediaHaven.pm view on Meta::CPAN
if ($response->is_success) {
return { ok => 1};
}
else {
my $json = $response->decoded_content;
return decode_json $json;
}
}
else {
$client->POST($url);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/RDF.pm view on Meta::CPAN
See documentation of modules for more examples.
=head1 DESCRIPTION
Catmandu::RDF contains modules for handling RDF data within the L<Catmandu>
framework. RDF data is encoded/decoded in L<aREF|http://gbv.github.io/aREF/> as
implemented with L<RDF::aREF>. Please keep in mind that RDF is a graph-based
data structuring format with specialized technologies such as SPARQL and triple
stores. Using Catmandu::RDF to transform RDF to RDF (e.g. conversion from one
RDF serialization to another) is possible but probably less performant than
decent RDF tools. Catmandu::RDF, however, is more conventient to convert
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/RKD/API/Search.pm view on Meta::CPAN
} else {
$url = $self->url;
}
my $response = $self->engine->get($url);
if ($response->is_success) {
return $response->decoded_content;
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return undef;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Store/Resolver/API.pm view on Meta::CPAN
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content
});
return undef;
}
}
lib/Catmandu/Store/Resolver/API.pm view on Meta::CPAN
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content
});
return undef;
}
}
lib/Catmandu/Store/Resolver/API.pm view on Meta::CPAN
my $response = $self->ua->get($req_url);
if ($response->is_success) {
# New API
return decode_json($response->decoded_content);
} else {
# If it is 404, it could be that the "new" api works,
# but that the entity doesn't exist. So we check for
# the presence of the error "Entity not found"
# Also, the new API returns the application/json content-type
lib/Catmandu/Store/Resolver/API.pm view on Meta::CPAN
# is not equal to the PID
$url = '%s/resolver/api/entity/%s';
$req_url = sprintf($url, $self->url, $id);
$response = $self->ua->get($req_url);
if ($response->is_success) {
return decode_json($response->decoded_content);
} elsif ($response->code == 404) {
return {
'data' => {}
};
} else {
lib/Catmandu/Store/Resolver/API.pm view on Meta::CPAN
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content
});
return undef;
}
}
}
lib/Catmandu/Store/Resolver/API.pm view on Meta::CPAN
$self->ua->cookie_jar($self->login());
my $response = $self->ua->post($req_url, Content_Type => 'application/json', Content => $json_data);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content
});
return undef;
}
}
lib/Catmandu/Store/Resolver/API.pm view on Meta::CPAN
$self->ua->cookie_jar($self->login());
my $response = $self->ua->put($req_url, Content_Type => 'application/json', Content => $json_data);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content
});
return undef;
}
}
lib/Catmandu/Store/Resolver/API.pm view on Meta::CPAN
$self->ua->cookie_jar($self->login());
my $response = $self->ua->delete($req_url);
if ($response->is_success) {
return $response->decoded_content;
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content
});
return undef;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Store/AAT/SPARQL.pm view on Meta::CPAN
my $form = {
'query' => $self->query
};
my $response = $self->ua->post($self->url, $form);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content
});
return undef;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Store/Datahub/API.pm view on Meta::CPAN
my $url = sprintf('%s/api/v1/data/%s', $self->url, $id);
my $response = $self->client->get($url, Authorization => sprintf('Bearer %s', $self->access_token));
if ($response->is_success) {
return decode_json($response->decoded_content);
} elsif ($response->code == 401) {
my $error = decode_json($response->decoded_content);
if ($error->{'error_description'} eq 'The access token provided has expired.') {
$self->set_access_token();
return $self->get($id);
}
} elsif ($response->code == 404) {
return {};
} else {
my $message = decode_json($response->decoded_content);
Catmandu::HTTPError->throw({
code => $response->code,
message => $message->{error}->{msg},
url => $response->request->uri->as_string,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return undef;
}
}
lib/Catmandu/Store/Datahub/API.pm view on Meta::CPAN
my $response;
$response = $self->client->post($url, Content_Type => 'application/lido+xml', Authorization => sprintf('Bearer %s', $token), Content => $data);
if ($response->is_success) {
return $response->decoded_content;
} elsif ($response->code == 401) {
my $error = decode_json($response->decoded_content);
if ($error->{'error_description'} eq 'The access token provided has expired.') {
$self->set_access_token();
return $self->add($data);
}
} else {
my $message = decode_json($response->decoded_content);
Catmandu::HTTPError->throw({
code => $response->code,
message => $message->{error}->{msg},
url => $response->request->uri->as_string,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return undef;
}
}
lib/Catmandu/Store/Datahub/API.pm view on Meta::CPAN
my $response;
$response = $self->client->put($url, Content_Type => 'application/lido+xml', Authorization => sprintf('Bearer %s', $token), Content => $data);
if ($response->is_success) {
return $response->decoded_content;
} elsif ($response->code == 401) {
my $error = decode_json($response->decoded_content);
if ($error->{'error_description'} eq 'The access token provided has expired.') {
$self->set_access_token();
return $self->update($id, $data);
}
} else {
my $message = decode_json($response->decoded_content);
Catmandu::HTTPError->throw({
code => $response->code,
message => $message->{error}->{msg},
url => $response->request->uri->as_string,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return undef;
}
}
lib/Catmandu/Store/Datahub/API.pm view on Meta::CPAN
my $response;
$response = $self->client->delete($url, Authorization => sprintf('Bearer %s', $token));
if ($response->is_success) {
return $response->decoded_content;
} elsif ($response->code == 401) {
my $error = decode_json($response->decoded_content);
if ($error->{'error_description'} eq 'The access token provided has expired.') {
$self->set_access_token();
return $self->delete($id);
}
} else {
my $message = decode_json($response->decoded_content);
Catmandu::HTTPError->throw({
code => $response->code,
message => $message->{error}->{msg},
url => $response->request->uri->as_string,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return undef;
}
}
lib/Catmandu/Store/Datahub/API.pm view on Meta::CPAN
my $token = $self->access_token;
my $response = $self->client->get($url, Authorization => sprintf('Bearer %s', $token));
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
my $message = decode_json($response->decoded_content);
Catmandu::HTTPError->throw({
code => $response->code,
message => $message->{error}->{msg},
url => $response->request->uri->as_string,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return undef;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Store/REST/API.pm view on Meta::CPAN
my $url = $self->mk_url($id);
my $response = $self->client->get($url);
if ($response->is_success) {
return decode_json($response->decoded_content);
} elsif ($response->code == 404) {
return {};
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->url,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return {};
}
}
lib/Catmandu/Store/REST/API.pm view on Meta::CPAN
my $json_data = encode_json($data);
my $response = $self->client->post($url, Content_Type => 'application/json', Content => $json_data);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->url,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return {};
}
}
lib/Catmandu/Store/REST/API.pm view on Meta::CPAN
my $json_data = encode_json($data);
my $response = $self->client->put($url, Content_Type => 'application/json', Content => $json_data);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->url,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return {};
}
}
lib/Catmandu/Store/REST/API.pm view on Meta::CPAN
my $url = $self->mk_url($id);
my $response = $self->client->delete($url);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->url,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return {};
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Store/RKD/API/Search.pm view on Meta::CPAN
} else {
$url = $self->url;
}
my $response = $self->engine->get($url);
if ($response->is_success) {
return $response->decoded_content;
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content,
});
return undef;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/VIAF/API/ID.pm view on Meta::CPAN
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content
});
return {};
}
}
my $rdf = $response->decoded_content;
my $document = sprintf('<?xml version="1.0" encoding="UTF-8"?>%s', $rdf);
my $parser = Catmandu::VIAF::API::Parse->new(items => $document);
return $parser->xml();
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/bitcoin.pl view on Meta::CPAN
$ua->agent('Mozilla/5.0'); # LWP UserAgent banned by default... Don't shoot the messenger...
$ua->default_header( 'Content-Type' => 'application/json' );
my $response = $ua->get('https://api.pro.coinbase.com/products/BTC-EUR/candles');
if ( $response->is_success() ) {
my $data = from_json( $response->decoded_content );
my ( @x, @open, @close, @high, @low );
for my $candle (@$data) {
push @x, DateTime->from_epoch( epoch => $candle->[0] );
push @low, $candle->[1];
push @high, $candle->[2];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chat/iFly.pm view on Meta::CPAN
sub _process_response {
my $self = shift;
my $response = shift;
if ($response->is_success) {
return $response->decoded_content;
}
else {
warn $response->decoded_content;
ouch $response->code, $response->message, $response->decoded_content;
}
}
=head1 PREREQS
view all matches for this distribution
view release on metacpan or search on metacpan
CheerLights/API.pm view on Meta::CPAN
my ($url) = @_;
my $ua = LWP::UserAgent->new;
my $response = $ua->get($url);
if ($response->is_success) {
return $response->decoded_content;
} else {
warn "Failed to fetch URL: " . $response->status_line;
return;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chef/Encoder.pm view on Meta::CPAN
returns base64 encoded value of data
=head4 B<decode>
it accepts data as parameter $obj->decode( 'data' => $data )
returns base64 decoded value of data
=cut
#-------------------------------#
# class Chef::Encoder::base64 #
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chess/PGN/Extract.pm view on Meta::CPAN
$out =~ s/\n//g;
$out =~ s/}/},/g;
chop $out;
$out = "[" . $out . "]";
my $decoded = try {
decode_json ($out);
} catch {
croak ("JSON parse error: $out");
};
lib/Chess/PGN/Extract.pm view on Meta::CPAN
else {
my $invalid_game = dump ($_);
STDERR->print ("Invalid PGN omitted: $invalid_game\n");
0;
}
} @$decoded;
foreach (@games) {
delete $_->{chash};
delete $_->{fhash};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chess/Plisco.pod view on Meta::CPAN
Generates a string representation of all bitboards in ASCII art plus some
additional information.
=item B<dumpInfo(INFO)>
Returns a string with the decoded position information as retured by
L</info>.
=item B<movesCoordinateNotation(MOVES)>
Takes an array of moves (as integers) and converts it into an array of moves
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chouette.pm view on Meta::CPAN
L<Chouette> is a framework for making asynchronous HTTP services. It makes some opinionated design choices, but is otherwise fairly flexible.
L<AnyEvent> is used as the glue to connect all the asynchronous libraries, although Chouette depends on L<Feersum> and therefore L<EV> for its event loop. It uses L<Feersum> in PSGI mode so it can use L<Plack> for request parsing, and has support for...
Chouette generally assumes that its input will be C<application/x-www-form-urlencoded>. L<Plack::Request::WithEncoding> is used so that text is properly decoded (we recommend UTF-8 of course). For output, the default is C<application/json> encoded wi...
Chouette apps can optionally load a config file and its format is C<YAML>, loaded with the L<YAML> module. L<Regexp::Assemble> is used for efficient route-dispatch.
The above aside, Chouette's main purpose is to glue together several of my own modules into a cohesive whole. These modules have been designed to work together and I have used them to build numerous services, some of which handle a considerable amoun...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Circle/Common.pm view on Meta::CPAN
$header = [ 'Content-Type' => 'application/json; charset=UTF-8' ];
}
my $request = HTTP::Request->new( 'POST', $url, $header, encode_json($data) );
my $response = $ua->request($request);
if ( $response->is_success ) {
return decode_json( $response->decoded_content );
}
else {
carp 'http_json_post' . $response->status_line ? $response->status_line : 'unknown';
return {
status => $response->status_line,
message => $response->decoded_content,
};
}
}
sub http_json_get {
lib/Circle/Common.pm view on Meta::CPAN
$header = [ 'Content-Type' => 'application/json; charset=UTF-8' ];
}
my $request = HTTP::Request->new( 'GET', $url, $header );
my $response = $ua->request($request);
if ( $response->is_success ) {
return decode_json( $response->decoded_content );
}
else {
carp 'http_json_get' . $response->status_line ? $response->status_line : 'unknown';
return {
status => $response->status_line,
message => $response->decoded_content,
};
}
}
sub get_host {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ClarID/Tools/Command/qrcode.pm view on Meta::CPAN
option 'outfile' => (
is => 'ro',
format => 's',
isa => Str,
default => sub { 'decoded.csv' },
doc => 'Where to write CSV (decode directory mode only)',
);
option 'sep' => (
is => 'ro',
lib/ClarID/Tools/Command/qrcode.pm view on Meta::CPAN
or croak "ERROR: 'zbarimg' not found in PATH";
# Single-file decode mode
if (-f $self->input && $self->input =~ /\.png$/i) {
my $file = $self->input;
chomp(my $decoded = qx(zbarimg --raw "$file" 2>/dev/null));
die "ERROR: no QR code found in '$file'\n" unless length $decoded;
say $decoded;
return 1;
}
# Directory decode mode
my $col_name = $self->column || 'clar_id';
lib/ClarID/Tools/Command/qrcode.pm view on Meta::CPAN
or croak "ERROR: Cannot write to '$self->outfile': $!";
print $out "$col_name\n";
for my $f (@files) {
my $path = "$self->{input}/$f";
chomp(my $decoded = qx(zbarimg --raw "$path" 2>/dev/null));
next unless length $decoded;
$decoded =~ s/\r?\n//g;
print $out "$decoded\n";
}
close $out;
say "Decoded CSV written to '$self->{outfile}'";
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/06-encoding.t view on Meta::CPAN
};
isa_ok my $p1 = Class::Param->new($params), 'Class::Param', 'Class::Param->new constructs a new instance';
isa_ok my $p2 = Class::Param::Encoding->new($p1), 'Class::Param::Encoding', 'Class::Param::Encoding->new constructs a new instance';
is $p2->get('A'), "\x{263A}", '->get A: returns right decoded value';
is $p2->param('A'), "\x{263A}", '->param A: returns right decoded value';
is $p2->get('B'), "\x{2639}", '->get B: returns right decoded value';
is $p2->param('B'), "\x{2639}", '->param B: returns right decoded value';
is_deeply $p2->get('C'), [ "\x{263A}", "\x{2639}" ], '->get C: returns right decoded values';
is_deeply [ $p2->param('C') ], [ "\x{263A}", "\x{2639}" ], '->param C: returns right decoded values';
is $p2->get('D'), "\x{263A}", '->get D: returns right decoded value';
is $p2->param('D'), "\x{263A}", '->param D: returns right decoded value';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/Usul/Functions.pm view on Meta::CPAN
Untaints directory path. Makes it an absolute path and returns it if it
exists. Returns undef otherwise
=head2 C<base64_decode_ns>
$decoded_value = base64_decode_ns $encoded_value;
Decode a scalar value encode using L</base64_encode_ns>
=head2 C<base64_encode_ns>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ClearPress/authenticator/session.pm view on Meta::CPAN
}
sub decode_token {
my ($self, $token) = @_;
my $decoded = q[];
eval {
$decoded = decode_base64($token);
} or do {
carp q[Failed to decode token];
return;
};
my $decrypted = q[];
eval {
$decrypted = $self->cipher->decrypt($decoded);
} or do {
carp q[Failed to decrypt token];
return;
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CloudFlare/Client.pm view on Meta::CPAN
CloudFlare::Client::Exception::Connection::->throw(
status => $res->status_line,
message => 'HTTPS request failed',)
unless $res->is_success;
# Handle errors from CF
Readonly my $info => decode_json($res->decoded_content);
CloudFlare::Client::Exception::Upstream::->throw(
errorCode => $info->{err_code},
message => $info->{msg},)
unless $info->{result} eq 'success';
view all matches for this distribution
view release on metacpan or search on metacpan
1.19 2016-03-28 12:13:34 -0400
- make hypnotoad test a dev only test
1.18 2016-03-24 15:49:47 -0400
- Documentation fixes
- Fix bug where errors from mojo were not being decoded correctly
in PlugAuth plugin
- make plackup test a dev only test
1.17 2016-03-14 12:18:27 -0400
- removed stragler deprecated use of auth_ua
view all matches for this distribution
view release on metacpan or search on metacpan
examples/helloworld/app/lib/Dwarf/Module/SocialMedia/Amazon.pm view on Meta::CPAN
if ($res->code !~ /^2/) {
$self->on_error->('Amazon OAuth Error: Could not get access token.');
return;
}
my $decoded = decode_json $res->{_content};
my $access_token = $decoded->{access_token};
$self->access_token($access_token);
}
sub _make_request {
examples/helloworld/app/lib/Dwarf/Module/SocialMedia/Amazon.pm view on Meta::CPAN
return $self->validate($res);
}
sub validate {
my ($self, $res) = @_;
my $content = eval { decode_json($res->decoded_content) };
if ($@) {
warn "Couldn't decode JSON: $@";
$content = $res->decoded_content;
}
# [todo]
# check error status codes
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CodeGen/Cpppp/CParser.pm view on Meta::CPAN
[ $type, $value, $offset, $length, $error=undef ]
$type: 'directive', 'comment', 'string', 'char', 'real', 'integer',
'keyword', 'ident', 'unknown', or any punctuation character
$value: for constants, this is the decoded string or numeric value
for directives and comments, it is the body text
for punctuation, it is a copy of $type
for unknown, it is the exact character that didn't parse
$src_pos: the character offset within the source $string
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Coerce/Types/Standard.pm view on Meta::CPAN
=back
=head2 HTML
Accepts a String and coerces it into entity encoded/decoded string, the default behaviour here is to entity encode the given string.
HTML->coerce('okay&');
*-*-*-*-*-*-*
okay&
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CohortExplorer/Application/Opal/Datasource.pm view on Meta::CPAN
Accept => "application/json"
);
my $res = $ua->request($req);
my $code = $res->code;
if ( $code == 200 ) {
my $json = decode_json( $res->decoded_content );
if ( $json->{type} ne 'mongodb' ) {
# Successful authentication returns tables and views accessible to the user
my %view = map { $_ => 1 } @{ $json->{view} || [] };
my @tables = @{ $json->{table} || [] };
lib/CohortExplorer/Application/Opal/Datasource.pm view on Meta::CPAN
);
my $entity_res = $ua->request($entity_req);
# Get the first identifier
if ( $entity_res->code == 200 ) {
my $decoded_json = decode_json( $entity_res->decoded_content );
my $var_req =
HTTP::Request->new( GET => $url
. "/ws/datasource/$ds_name/table/$t/valueSet/"
. ( $decoded_json->[0]->{identifier} || '' ) );
$var_req->header(
Authorization => "X-Opal-Auth "
. MIME::Base64::encode( join ':', @opts{qw/username password/} ),
Accept => "application/json"
);
my $var_res = $ua->request($var_req);
# Get all variables with accessible values
if ( $var_res->code == 200 ) {
$decoded_json = decode_json( $var_res->decoded_content );
push @{ $param{allowed_variables} },
map { "$t.$_" } @{ $decoded_json->{variables} };
}
else {
die "Failed to fetch variable list via $url (error "
. $var_res->code . ")\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/03_render.t view on Meta::CPAN
is(CommonMark->markdown_to_html("\x{263A}"), "<p>\x{263A}</p>\n",
'render functions return encoded utf8');
is(CommonMark->markdown_to_html("\xC2\xA9"), "<p>\xC2\xA9</p>\n",
'render functions expect decoded utf8');
view all matches for this distribution