Group
Extension

Matches 35358

Code-TidyAll ( D/DR/DROLSKY/Code-TidyAll-0.85.tar.gz, DROLSKY, 2025; MetaCPAN )
Code-TidyAll/lib/Code/TidyAll/Plugin/GenericValidator.pm ( view source; MetaCPAN )

version 0.85

=head1 SYNOPSIS

    # In your tidyall config
    [GenericValidator / JSONOrderedTidy]
    cmd = json-ordered-tidy
    argv = -check
    ok_exit_codes = 0 1

=head1 DESCRIPTION

This pl
Code-TidyAll ( D/DR/DROLSKY/Code-TidyAll-0.85.tar.gz, DROLSKY, 2025; MetaCPAN )
Code-TidyAll/lib/Code/TidyAll/Plugin/JSHint.pm ( view source; MetaCPAN )
hift;

    return unless $self->_has_options;

    my $conf_file = $self->_tempdir->child('jshint.json');
    $conf_file->spew(
        '{ ' . join( ",\n", map {qq["$_": true]} split /\s+/, $self->opt
ef

   ; or refer to a jshint.json config file in the same directory
   ;
   [JSHint]
   select = static/**/*.js
   argv = --config $ROOT/jshint.json

   where jshint.json looks like

   {
      "bitw
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF/Response.pm ( view source; MetaCPAN )
EXPORT = qw|
  resInit resHeader resCookie resBuffer resFd resStatus resRedirect
  resNotFound resJSON resBinary resFile resFinish
|;


# try to load PerlIO::gzip, resBuffer will check for its availab
lf);
}


my $_json_codec;
sub resJSON {
  my($self, $obj) = @_;
  $_json_codec ||= TUWF::Misc::_JSON()->new->convert_blessed->utf8;

  $self->resHeader('Content-Type' => 'application/json; charset=UTF
-8');
  $self->resBinary($_json_codec->encode($obj), 'clear');
}


sub resBinary {
  my($self, $data, $buffer) = @_;
  my $enc = $self->resBuffer($buffer//'none', 'noutf8');

  if($enc eq 'none') {
  
dbd_mock_dump_data ( U/UX/UXYZAB/dbd_mock_dump_data-.tar.gz, UXYZAB, 2025; MetaCPAN )
dbd_mock_dump_data/lib/DBD/Mock/Session/GenerateFixtures.pm ( view source; MetaCPAN )
);
use Cpanel::JSON::XS;
use File::Slurper qw (read_text);
use File::Spec;
use Readonly;
use Data::Walk;
use Try::Tiny;

our $VERSION = 0.10;

our $override;
my $JSON_OBJ = Cpanel::JSON::XS->new()->ut
fixtures);
		$self->_set_mock_dbh($fixtures);
	} elsif (-e $self->{fixture_file}) {
		my $data = $JSON_OBJ->decode(read_text($self->{fixture_file}));
		$self->_process_mock_data($data);
		$self->_set_
($directory . $FIXTURE_DIR);
		my $default_fixture_file = $directory . $FIXTURE_DIR . "$test_file.json";
		$self->{fixture_file} = $default_fixture_file;
	}

	return $self;
}

sub _validate_args {
	my
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF/Request.pod ( view source; MetaCPAN )
d2 reqJSON()

Returns the decoded JSON object if the request body was of type
C<application/json>; Returns C<undef> otherwise.

This requires either the L<JSON::XS>, L<Cpanel::JSON::XS> or L<JSON::PP>

module. If none of these modules is not available, any request with a JSON body
will automatically get a 500 response.

=head2 reqUploadMIMEs(name)

When I<name> is not given, returns a list of all p
Code-TidyAll ( D/DR/DROLSKY/Code-TidyAll-0.85.tar.gz, DROLSKY, 2025; MetaCPAN )
Code-TidyAll/lib/Code/TidyAll/Plugin/GenericTransformer.pm ( view source; MetaCPAN )
ersion 0.85

=head1 SYNOPSIS

    # In your tidyall config
    [GenericTransformer / JSONOrderedTidy]
    cmd = json-ordered-tidy
    argv = -stdout
    ok_exit_codes = 0 1

=head1 DESCRIPTION

This p
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF/Response.pod ( view source; MetaCPAN )
nd cookies set before calling C<resRedirect()>.

=head2 resJSON(data)

Sets the content type to C<application/json> and sends the encoded JSON object
to the client.

=head2 resBinary(data, buffer_acti
Module-Starter ( D/DB/DBOOK/Module-Starter-1.78.tar.gz, DBOOK, 2025; MetaCPAN )
Module-Starter/lib/Module/Starter/Simple.pm ( view source; MetaCPAN )
mples|lib|inc|t|xt|maint)/|(?:(?:Makefile|Build)\.PL|README|LICENSE|MANIFEST|Changes|META\.(?:yml|json))$)

# Avoid version control files.
\bRCS\b
\bCVS\b
,v$
\B\.svn\b
\b_darcs\b
# (.git or .hg only 
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF/Validate.pm ( view source; MetaCPAN )
    # Error objects should be plain data structures so that they can easily
    # be converted to JSON for debugging. We have to stringify $reg in the
    # error object to ensure that.
    +{ type =>
0] = $_[0] ? 1 : 0; 1 } },
  jsonbool  => { type => 'any', func => sub {
    my $r = $_[0];
    blessed $r && (
         $r->isa('JSON::PP::Boolean')
      || $r->isa('JSON::XS::Boolean')
      || $r-
   || $r->isa('Cpanel::JSON::XS::Boolean')
      || $r->isa('boolean')
    ) ? 1 : {};
  } },

  # JSON number format, regex from http://stackoverflow.com/questions/13340717/json-numbers-regular-expre
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF/Misc.pod ( view source; MetaCPAN )
rgument  Source
    post     reqPosts()
    get      reqGets()
    param    reqParams()
    json     reqJSON()

This method takes several different forms for the further arguments (the
examples below 
re schema will be compiled with the
L<custom_validations|TUWF/custom_validations> setting.

The C<json> source only supports the I<Hash value> form. Using the C<param>
source is discouraged, as it is 
ype => 'array', scalar => 1} >> schema.

Some examples:

  # JSON, with custom error handling
  my $validation_result = tuwf->validate(json => {
    type => 'hash',
    keys => {
      username => { l
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF/Misc.pm ( view source; MetaCPAN )
 > $_[1]{max};
  return 1;
}


my %default_templates = (
  # JSON number format, regex from http://stackoverflow.com/questions/13340717/json-numbers-regular-expression
  num    => { func => \&_templat
 {
  my $self = shift;
  my $what = shift;

  return _compile($_[0])->validate($self->reqJSON) if $what eq 'json';

  # 'param' is special, and not really encouraged. Create a new hash based on
  # re
riate JSON
# module. Kinda like JSON::MaybeXS, but without an extra dependency.
sub _JSON {
    return 'JSON::XS'         if $INC{'JSON/XS.pm'};
    return 'Cpanel::JSON::XS' if $INC{'Cpanel/JSON/XS.p
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF/Request.pm ( view source; MetaCPAN )
ERSION = '1.6';
our @EXPORT = qw|
  reqInit reqGets reqGet reqPosts reqPost reqParams reqParam reqJSON
  reqUploadMIMEs reqUploadMIME reqUploadRaws reqUploadRaw reqSaveUpload
  reqCookie reqMethod req
YPE'}||'') =~ m{^application/json(?:;.*)?$}) {
        $self->{_TUWF}{Req}{JSON} = _parse_json($data);
        die TUWF::Exception->new('json') if !$self->{_TUWF}{Req}{JSON};
      } elsif(($RENV->{'C
}, $val;
  }
  return \%dat;
}


my $_json_codec;
sub _parse_json {
  my $d = shift;
  $_json_codec ||= TUWF::Misc::_JSON()->new->utf8;

  my $res = eval { $_json_codec->decode($d) };
  return undef i
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF/Validate.pod ( view source; MetaCPAN )
a of
truth.

=item jsonbool => 1

Require the input to be a boolean type returned by a JSON parser. Supported
types are L<JSON::PP>, L<JSON::XS>, L<Types::Serialiser>, L<Cpanel::JSON::XS>
and L<boolea
C<< type => 'scalar' >>. Require the input to be a number formatted
using the format permitted by JSON. Note that this is slightly more restrictive
from Perl's number formatting, in that 'NaN', 'Inf' 
it faster than
TUWF::Validate, at the cost of higher memory usage and a large dependency tree.

L<JSON::Schema> is similar to Sah: It features more advanced data structure
validation, but the schema i
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF/Validate/Interop.pm ( view source; MetaCPAN )
t'     || $n eq 'uint';
  $o->{type} = 'bool'   if $n eq 'anybool' || $n eq 'undefbool' || $n eq 'jsonbool';
  $o->{type} = 'num'    if $n eq 'num';
}


sub _merge {
  my($c, $o) = @_;

  _merge_type 
odd things may
# happen if this is not the case.
#   unknown => remove|reject|pass
sub coerce_for_json {
  my($o, $obj, %opt) = @_;
  $opt{unknown} ||= $o->{unknown};
  return undef if !defined $obj;
o->{values}->coerce_for_json($_, %opt), @$obj] if $o->{type} eq 'array' && $o->{values};
  return {map {
        $o->{keys}{$_}            ? ($_, $o->{keys}{$_}->coerce_for_json($obj->{$_}, %opt)) :
 
Dist-Zilla-App-Command-regenerate ( D/DB/DBOOK/Dist-Zilla-App-Command-regenerate-0.001003.tar.gz, DBOOK, 2025; MetaCPAN )
Dist-Zilla-App-Command-regenerate/lib/Dist/Zilla/Role/Regenerator.pm ( view source; MetaCPAN )
CONTRIBUTING.pod')->spew_raw($content);
    path($config->{build_root}, 'META.json')->copy(path($config->{root}, 'META.json'));
  }

=head1 DESCRIPTION

This role is for C<Dist::Zilla> C<Plugin>'s tha
la>

=item * Copy files from the build tree

  path($config->{build_root}, "META.json")->copy($path->{root}, "META.json");

( Note: This case is implemented by L<< C<[Regenerate]>|Dist::Zilla::Plugin:
TUWF ( Y/YO/YORHEL/TUWF-1.6.tar.gz, YORHEL, 2025; MetaCPAN )
TUWF/lib/TUWF.pm ( view source; MetaCPAN )
     jpeg   image/jpeg
      jpg    image/jpeg
      js     application/javascript
      json   application/json
      jxl    image/jxl
      mjs    application/javascript
      mp3    audio/mpeg
    
ontrolchar';
  warn "Client sent an invalid JSON object. Generating HTTP 400 response.\n" if $terr eq 'json';

  my $han = {
    utf8        => 400,
    json        => 400,
    controlchar => 400,
   
ader($_)), $self->reqHeader).
    "POST dump:\n".
    ($self->reqJSON()
      ? TUWF::Misc::_JSON()->new->pretty->encode($self->reqJSON())
      : join('', map sprintf("  %s: %s\n", $_, join "\n    ",
Langertha ( G/GE/GETTY/Langertha-0.008.tar.gz, GETTY, 2025; MetaCPAN )
Langertha/lib/Langertha/Role/HTTP.pm ( view source; MetaCPAN )
ommon;

requires qw(
  json
);

has url => (
  is => 'ro',
  isa => 'Str',
  predicate => 'has_url',
);

sub generate_json_body {
  my ( $self, %args ) = @_;
  return $self->json->encode({ %args });
}
/json; charset=utf-8' )
  ];
  my $request = Langertha::Request::HTTP->new(
    http => [ uc($method), $uri, $headers, ( scalar %args > 0 ?
      ( !$content_type or $content_type eq 'application/json
' )
        ? $self->generate_json_body(%args)
          : ()
      : ()
    ) ],
    request_source => $self,
    response_call => $response_call,
  );
  if ($content_type and $content_type eq 'multi
Langertha ( G/GE/GETTY/Langertha-0.008.tar.gz, GETTY, 2025; MetaCPAN )
Langertha/ex/json_grammar.pl ( view source; MetaCPAN )
rl
# ABSTRACT: JSON grammar test

$|=1;

use FindBin;
use lib "$FindBin::Bin/../lib";

use utf8;
use open ':std', ':encoding(UTF-8)';
use strict;
use warnings;
use Data::Dumper;
use JSON::MaybeXS;
use
s $ENV{OLLAMA_URL};

my $model = $ENV{OLLAMA_MODEL} || 'gemma2:2b';

my $jsonschema = <<'__EOS__';

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    
s JSON, and your JSON always follows this specific JSON Schema:

$jsonschema

__EOP__

{
  my $start = time;

  my $ollamajson = Langertha::Engine::Ollama->new(
    url => $ENV{OLLAMA_URL},
    json_f
Langertha ( G/GE/GETTY/Langertha-0.008.tar.gz, GETTY, 2025; MetaCPAN )
Langertha/lib/Langertha/Role/OpenAPI.pm ( view source; MetaCPAN )
rp qw( croak );
use JSON::MaybeXS ();
use JSON::PP ();
use OpenAPI::Modern;
use Path::Tiny;
use URI;
use YAML::PP;

requires qw(
  openapi_file
  generate_http_request
  url
  json
);

has openapi => 
n OpenAPI::Modern->new(
    openapi_uri => $yaml,
    openapi_schema => YAML::PP->new(boolean => 'JSON::PP')->load_string(path($yaml)->slurp_utf8),
  );
}

has supported_operations => (
  is => 'ro',
->{requestBody}->{content} )
    ? $operation->{requestBody}->{content}->{'application/json'} ? 'application/json'
      : $operation->{requestBody}->{content}->{'multipart/form-data'} ? 'multipart/fo
Data-Validate-Sanctions ( D/DE/DERIV/Data-Validate-Sanctions-0.19.tar.gz, DERIV, 2025; MetaCPAN )
Data-Validate-Sanctions/lib/Data/Validate/Sanctions/Fetcher.pm ( view source; MetaCPAN )
e Text::Trim qw(trim);
use Syntax::Keyword::Try;
use XML::Fast;
use Locale::Country;
use JSON        qw(to_json);
use Digest::SHA qw(sha256_hex);
use Encode      qw(encode);

use constant MAX_REDIRECT
a);

=cut

sub _create_hash {
    my ($data) = @_;

    # Convert the data to a JSON string
    my $json_string = to_json(
        $data,
        {
            canonical => 1,
            utf8      =>
 1
        });

    # Generate and return the SHA-256 hash
    return sha256_hex($json_string);
}

1;

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.