tribution provides a
collection of roles that help you populate the distribution's metadata
(META.json, Changes, etc) from DOAP.
=head2 The Straight DOAP
So what is DOAP? This explanation is lifted
TTP::Tiny;
use Carp qw(confess);
use WebService::Geocodio::Location;
with 'WebService::Geocodio::JSON';
# ABSTRACT: A request role for Geocod.io
has 'ua' => (
is => 'ro',
lazy => 1,
de
agent => "WebService-Geocodio ",
default_headers => { 'Content-Type' => 'application/json' },
) },
);
has 'base_url' => (
is => 'ro',
lazy => 1,
default => sub { 'http:/
t for you.
=item parse_to_jet($string, %options)
As before, but the result is encoded as simple JSON-Encoding for Trees.
=back
=head1 ERROR HANDLING
The C<parse> method will retun C<undef> if the
uComment;
struct CFCFunction;
struct CFCMethod;
struct CFCVariable;
struct CFCFileSpec;
struct CFCJson;
/** Return true if the string is a valid class name.
*/
int
CFCClass_validate_class_name(const
ss *self);
/** Read host-specific data for the class from a JSON hash.
*/
void
CFCClass_read_host_data_json(CFCClass *self, struct CFCJson *hash,
const char *path);
/**
Moo;
use MooX::late;
use Carp ();
use Data::Dumper qw(Dumper);
use LWP::UserAgent;
use JSON qw(from_json to_json);
has token => (is => 'ro', required => 1);
has sheets => (is => 'rw', isa => 'Array
thorization" => "Bearer " . $self->token);
$ua->default_header("Content-Type" => "application/json");
return $ua;
}
sub get_current_user {
my ($self) = @_;
my $current_user = $self->_get
"$API_URL/$path";
my $ua = $self->ua;
my $json = to_json($data);
my $req = HTTP::Request->new( 'POST', $url );
$req->content( $json );
my $res = $ua->request( $req );
Carp::
s packaged up, delete the copied assets.
rmtree($_) for values %to_copy;
unlink("META.yml");
unlink("META.json");
move( "MANIFEST.bak", "MANIFEST" ) or die "move() failed: $!";
}
1;
you can use a fancy object like L<WebService::Geocodio::Location> which will serialize
itself to JSON automatically.
=head2 fields
You may request the following fields be included in the results:
l*
CFCParcel_new_from_file(struct CFCFileSpec *file_spec);
CFCParcel*
CFCParcel_new_from_json(const char *json, struct CFCFileSpec *file_spec);
CFCParcel*
CFCParcel_init(CFCParcel *self, const char
Parcel *parcel);
/** Read host-specific data for an included parcel from a JSON file.
*/
void
CFCParcel_read_host_data_json(CFCParcel *self, const char *host_lang);
void
CFCParcel_add_struct_sym(CF
CFCJSON
#define H_CFCJSON
#ifdef __cplusplus
extern "C" {
#endif
#define CFCJSON_STRING 1
#define CFCJSON_HASH 2
#define CFCJSON_NULL 3
#define CFCJSON_BOOL 4
typedef struct CFCJson CFCJson;
CFCJson*
CFCJson_parse(const char *json);
void
CFCJson_destroy(CFCJson *self);
int
CFCJson_get_type(CFCJson *self);
const char*
CFCJson_get_string(CFCJson *self);
int
CFCJson_get_bool(CFCJson *se
lf);
size_t
CFCJson_get_num_children(CFCJson *self);
CFCJson**
CFCJson_get_children(CFCJson *self);
CFCJson*
CFCJson_find_hash_elem(CFCJson *self, const char *key);
#ifdef __cplusplus
}
#endif
#e
package WebService::Qiita::V2::Client::Base;
use strict;
use warnings;
use JSON;
use LWP::UserAgent;
use HTTP::Request;
use URI;
use constant {
API_URL => 'qiita.com/api/',
API_VER => 'v2',
$req->content_type('application/json');
my $res = $self->ua->request($req);
if ($res->code == 200) {
my $result = ($res->content) ? JSON::decode_json($res->content) : "";
re
plication/json');
$req->content(JSON::encode_json $params);
my $res = $self->ua->request($req);
if ($res->code == 201) {
my $result = ($res->content) ? JSON::decode_json($res->co
struct CFCClass *klass);
/** Return a JSON fragment for method data specified by the host bindings
* (alias or excluded).
*/
char*
CFCBindMeth_host_data_json(struct CFCMethod *method);
#ifdef __c
CFCMethod;
struct CFCType;
struct CFCClass;
struct CFCParamList;
struct CFCDocuComment;
struct CFCJson;
/**
* @param exposure See Clownfish::CFC::Model::Symbol. Defaults to "parcel"
* if not suppl
method);
/** Read host-specific data for the method from a JSON hash.
*/
void
CFCMethod_read_host_data_json(CFCMethod *self, struct CFCJson *hash,
const char *path);
/
e the copied assets.
rmtree($_) for values %to_copy;
unlink("META.yml");
unlink("META.json");
move( "MANIFEST.bak", "MANIFEST" ) or die "move() failed: $!";
}
# Strip POD from files i
archy->add_include_dir($include_dir);
}
$hierarchy->build;
$hierarchy->read_host_data_json;
# Process all Binding classes in buildlib.
local @INC = ( @INC, '.' );
my $pm_filep
$cfh_filepaths = $self->_cfh_filepaths;
my $log_filepath = catfile( $AUTOGEN_DIR, 'hierarchy.json' );
# Don't bother parsing Clownfish files if everything's up to date.
return
if
arcels => $module->{parcels},
);
}
$core_binding->write_host_data_json($inc_dir);
unless ($IS_CPAN_DIST) {
print "Writing POD...\n";
my
nfile') {
return Module::CPANfile->load($src)->prereq_specs;
} elsif ($src =~ /\.(yml|json)$/) {
my $meta = CPAN::Meta->load_file($src);
my $meta_prereqs = CPAN::Meta::Prer
($meta->prereqs)->as_string_hash;
return $meta_prereqs;
} else {
die "No META.json and cpanfile\n";
}
}
sub read_from_file {
my ($fname, $length) = @_;
return q{} if !
# Ignore build dir like Dist-Name-0.01/.
return if -f "$topdir/META.json";
for my $ignored (@$ignore) {
return if $topdir eq $ignored
namespacing and versioning. Information about parcels is stored in C<.cfp>
files which contain a JSON hash with the following keys:
=over
=item *
B<name:> The parcel’s name. It must contain only
0;
use utf8;
use strict;
use warnings;
use Carp;
use URI;
use MIME::Base64;
use URI::Escape;
use JSON 2.23;
use Data::Util qw/:check/;
use REST::Client;
sub new {
my ($class, $URL, $username, $p
er(Accept => 'application/json');
# Configure UserAgent name
$rest->getUseragent->agent(__PACKAGE__);
return bless {
rest => $rest,
json => JSON->new->utf8->allow_nonref,
m:text/plain:i) {
$msg .= $content;
} elsif ($type =~ m:application/json:) {
my $error = $self->{json}->decode($content);
if (ref $error eq 'HASH' && exists $error->{errorM
self, const char *dest_dir);
/* Write host-specific data to a JSON file for each source parcel.
*/
void
CFCBindCore_write_host_data_json(CFCBindCore *self, const char *dest_dir,
;
PPCODE:
CFCHierarchy_build(self);
void
read_host_data_json(self)
CFCHierarchy *self;
PPCODE:
CFCHierarchy_read_host_data_json(self, "perl");
int
propagate_modified(self, ...)
CFCHi
elf);
OUTPUT: RETVAL
SV*
_new_from_json(json, file_spec)
const char *json;
CFCFileSpec *file_spec;
CODE:
CFCParcel *self = CFCParcel_new_from_json(json, file_spec);
RETVAL = S_cfcbase
ers(self, dest_dir);
void
write_host_data_json(self, dest_dir)
CFCBindCore *self;
const char *dest_dir;
PPCODE:
CFCBindCore_write_host_data_json(self, dest_dir, "perl");
MODULE = Clownf
y *self);
/** Read host-specific data for included parcels.
*/
void
CFCHierarchy_read_host_data_json(CFCHierarchy *self, const char *host_lang);
/** Visit all File objects in the hierarchy. If a p
modified.
*/
int
CFCHierarchy_propagate_modified(CFCHierarchy *self, int modified);
/** Write a JSON files with statistics about the class hierarchy. At the
* moment, this file is empty. It is only