Result:
found more than 953 distributions - search limited to the first 2001 files matching your query ( run in 0.448 )


Dancer2-Plugin-Feed

 view release on metacpan or  search on metacpan

t/01-basic.t  view on Meta::CPAN

for my $format (qw/atom rss/) {
    for my $route ("/feed/$format", "/other/feed/$format") {
        ok ($res = $psgi->request( GET $route ) );
        is $res->code, 200, "$format - $route";
        is ($res->header('Content-Type'), "application/$format+xml");
        ok ( $feed = XML::Feed->parse( \$res->decoded_content ) );
        is ( $feed->title, 'TestApp with ' . $format );
        my @entries = $feed->entries;
        is (scalar @entries, 10);
        is ($entries[0]->title, 'entry 1');
    }

 view all matches for this distribution


Dancer2-Plugin-GraphQL

 view release on metacpan or  search on metacpan

t/ajax.t  view on Meta::CPAN

    POST '/graphql',
      Content_Type => 'application/json',
      Content => '{"query":"{helloWorld}"}',
  );
  my $json = JSON::MaybeXS->new->allow_nonref;
  is_deeply eval { $json->decode( $res->decoded_content ) },
    { 'data' => { 'helloWorld' => 'Hello, world!' } },
    'Content as expected';
};

subtest 'GraphQL with route-handler' => sub {

t/ajax.t  view on Meta::CPAN

    POST '/graphql2',
      Content_Type => 'application/json',
      Content => '{"query":"{helloWorld}"}',
  );
  my $json = JSON::MaybeXS->new->allow_nonref;
  is_deeply eval { $json->decode( $res->decoded_content ) },
    { 'data' => { 'helloWorld' => 'Hello, world!' } },
    'Content as expected';
};

subtest 'GraphQL with die' => sub {

t/ajax.t  view on Meta::CPAN

    POST '/graphql-live-and-let-die',
      Content_Type => 'application/json',
      Content => '{"query":"{helloWorld}"}',
  );
  my $json = JSON::MaybeXS->new->allow_nonref;
  is_deeply eval { $json->decode( $res->decoded_content ) },
    { errors => [ { message => "I died!\n" } ] },
    'error as expected';
};

subtest 'GraphiQL' => sub {
  my $res = $test->request(
    GET '/graphql',
      Accept => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  );
  like $res->decoded_content, qr/React.createElement\(GraphiQL/, 'Content as expected';
};

done_testing;

 view all matches for this distribution


Dancer2-Plugin-JWT

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/JWT.pm  view on Meta::CPAN

                elsif ($app->request->param('_jwt')) {
                    $encoded = $app->request->param('_jwt');
                }

                if ($encoded) {
                    my $decoded;
                    eval {
                        $decoded = decode_jwt( token        => $encoded,
                                               key          => $secret,
                                               verify_iat   => $need_iat,
                                               verify_nbf   => $need_nbf,
                                               verify_exp   => defined $need_exp ? 1 : 0 ,
                                               leeway       => $need_leeway,

lib/Dancer2/Plugin/JWT.pm  view on Meta::CPAN

                                               accepted_enc => $enc );
                    };
                    if ($@) {
                        $app->execute_hook('plugin.jwt.jwt_exception' => ($a = $@));  # this is weird, but required!
                    };
                    $app->request->var('jwt', $decoded);
                    $app->request->var('jwt_status' => 'present');

                }
                else {
                    ## no token

lib/Dancer2/Plugin/JWT.pm  view on Meta::CPAN

    $dsl->app->add_hook(
        Dancer2::Core::Hook->new(
            name => 'after',
            code => sub {
                my $response = shift;
                my $decoded = $dsl->app->request->var('jwt');
                if($set_authorization_header || $set_cookie_header || $set_location_header) {
                    # If all are disabled, then skip also encoding!
                    if (defined($decoded)) {
                        my $encoded = encode_jwt( payload      => $decoded,
                                                  key          => $secret,
                                                  alg          => $alg,
                                                  enc          => $enc,
                                                  auto_iat     => $need_iat,
                                                  relative_exp => $need_exp,

 view all matches for this distribution


Dancer2-Plugin-LiteBlog

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/LiteBlog/Scaffolder.pm  view on Meta::CPAN

    my ($base64_content, $output_path) = @_;

    # Decode the base64 string
    my $binary_data = decode_base64($base64_content);

    # Write the decoded binary data to a file
    write_file($output_path, {binmode => ':raw'}, $binary_data);
}

sub scaffold {
    my ($basedir, $force) = @_;

 view all matches for this distribution


Dancer2-Plugin-OAuth2-Server

 view release on metacpan or  search on metacpan

t/custom.t  view on Meta::CPAN

my $code = $uri->query_param( 'code' );

$request  = POST '/access_token', Content => [ client_id => 'client1', client_secret => 'secret', grant_type => 'authorization_code', code => $code, redirect_uri => 'http://localhost/callback' ];
$response = $test->request($request);
is $response->code, 200, "Access token route working";
my $decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";
my $access_token = $decoded->{access_token};
my $refresh_token = $decoded->{refresh_token};

$request  = HTTP::Request->new( GET => '/protected-identity' );
$request->header( Authorization => "Bearer $access_token");
$response = $test->request($request);
is $response->code, 200, "With bearer, protected route OK";

t/custom.t  view on Meta::CPAN

is $response->code, 400, "With bearer, protected route with another scope KO";

$request  = POST '/access_token', Content => [ client_id => 'client1', client_secret => 'secret', grant_type => 'refresh_token', refresh_token => $refresh_token ];
$response = $test->request($request);
is $response->code, 200, "Refresh access token succesfully";
$decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";
my $new_access_token = $decoded->{access_token};
my $new_refresh_token = $decoded->{refresh_token};
isnt $new_access_token, $access_token, "Access token has changed";
isnt $new_refresh_token, $refresh_token, "Refresh token has changed";
#ok exists $decoded->{access_token}, "Access token provided";

$request  = HTTP::Request->new( GET => '/protected-identity' );
$request->header( Authorization => "Bearer $new_access_token");
$response = $test->request($request);
is $response->code, 200, "With bearer, new access token, protected route OK";

t/custom.t  view on Meta::CPAN

my $code = $uri->query_param( 'code' );

$request  = POST '/access_token', Content => [ client_id => 'client2', client_secret => 'secret2', grant_type => 'authorization_code', code => $code, redirect_uri => 'http://localhost/callback' ];
$response = $test->request($request);
is $response->code, 200, "Access token route working";
my $decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";
my $access_token = $decoded->{access_token};
my $refresh_token = $decoded->{refresh_token};

$request  = HTTP::Request->new( GET => '/protected-identity' );
$request->header( Authorization => "Bearer $access_token");
$response = $test->request($request);
is $response->code, 200, "With bearer, protected route OK";

t/custom.t  view on Meta::CPAN

my $code = $uri->query_param( 'code' );

$request  = POST '/access_token', Content => [ client_id => 'client2', client_secret => 'secret2', grant_type => 'authorization_code', code => $code, redirect_uri => 'http://localhost/callback' ];
$response = $test->request($request);
is $response->code, 200, "Access token route working";
my $decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";
my $access_token = $decoded->{access_token};
my $refresh_token = $decoded->{refresh_token};

$request  = HTTP::Request->new( GET => '/protected-identity' );
$request->header( Authorization => "Bearer $access_token");
$response = $test->request($request);
is $response->code, 200, "With bearer, protected route OK";

t/custom.t  view on Meta::CPAN

my $code = $uri->query_param( 'code' );

$request  = POST '/access_token', Content => [ client_id => 'client2', client_secret => 'secret2', grant_type => 'authorization_code', code => $code, redirect_uri => 'http://localhost/callback' ];
$response = $test->request($request);
is $response->code, 200, "Access token route working";
my $decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";

#try to use the same code a second time
$response = $test->request($request);
is $response->code, 400, "Access token route not working, authorization code already consumed";
my $decoded = from_json( $response->content );
ok !exists $decoded->{access_token}, "Access token not provided";
ok !exists $decoded->{refresh_token}, "Refresh token not provided";

#Wrong scope
my $uri = URI->new( '/authorize' );
$uri->query_param( client_id => 'client1' );
$uri->query_param( redirect_uri => 'http://localhost/callback' );

 view all matches for this distribution


Dancer2-Plugin-OpenTelemetry

 view release on metacpan or  search on metacpan

t/basic.t  view on Meta::CPAN


my $test = Plack::Test->create( Local::App->to_app );

subtest 'Static URL' => sub {
    is $test->request( GET '/static/url?query=parameter' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

    ], 'Expected calls on span';
};

subtest 'Forward' => sub {
    is $test->request( GET '/forward' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

    ], 'Expected calls on span';
};

subtest 'Pass' => sub {
    is $test->request( GET '/url/with/pass' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

subtest 'Async' => sub {
    require Test2::Require::Module;
    Test2::Require::Module->import('IO::Async');

    is $test->request( GET '/async', user_agent => 'Test' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

    ], 'Expected calls on span';
};

subtest 'With placeholder' => sub {
    is $test->request( GET '/url/with/value' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

};

subtest 'Response code' => sub {
    is $test->request( GET '/status/400' ), object {
        call code            => 400;
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

 view all matches for this distribution


Dancer2-Plugin-ParamKeywords

 view release on metacpan or  search on metacpan

t/plugin.t  view on Meta::CPAN

subtest 'Route param' => sub {
    my $res = $test->request(
        POST '/route/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'foo', 'Route returns foo' );
};

subtest 'Query param' => sub {
    my $res = $test->request(
        POST '/query/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'bar', 'Query returns bar' );
};

subtest 'Body param' => sub {
    my $res = $test->request(
        POST '/body/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'baz', 'Body returns baz' );
};

subtest 'All params' => sub {
    my $res = $test->request(
        POST '/params/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'foo bar baz', 'All params returns foo bar baz' );
};

subtest 'Munged params route' => sub {
    my $res = $test->request(
        POST '/munged/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'foo', 'Munge honors route' );
};

subtest 'Munged params query' => sub {
    my $res = $test->request(
        POST '/munged?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'bar', 'Munge honors query' );
};

subtest 'Munged params body' => sub {
    my $res = $test->request(
        POST '/munged', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'baz', 'Munge honors body' );
};

subtest 'Munged param route' => sub {
    my $res = $test->request(
        POST '/munged_singular/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'foo', 'Munge singular honors route' );
};

subtest 'Munged param query' => sub {
    my $res = $test->request(
        POST '/munged_singular?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'bar', 'Munge singular honors query' );
};

subtest 'Munged param body' => sub {
    my $res = $test->request(
        POST '/munged_singular', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'baz', 'Munge singular honors body' );
};


done_testing;

 view all matches for this distribution


Dancer2-Plugin-ProgressStatus

 view release on metacpan or  search on metacpan

t/test-progress.t  view on Meta::CPAN

    ok( $response1->is_success, 'Response ok when setting and updating progress' );

    my $response2 = $app->request( GET '/_progress_status/test' );
    ok($response2->is_success, 'Get good response from progressstatus');

    my $data = $json->decode($response2->decoded_content);
    is($data->{total}, 100, 'Total is 100');
    is($data->{count}, 2, 'Count matches total');
    ok(!$data->{in_progress}, 'No longer in progress');
}

t/test-progress.t  view on Meta::CPAN

{
    my $response1 = $app->request( GET '/test_progress_status_with_args' );
    ok( $response1->is_success, 'Success for less simple progress' );

    my $response2 = $app->request( GET '/_progress_status/test2' );
    my $data = $json->decode($response2->decoded_content);
    is($data->{total}, 200, 'Total is 200');
    is($data->{count}, 3, 'Count matches total');
    is(scalar(@{$data->{messages}}), 2, 'Has two messages');
    ok(!$data->{in_progress}, 'No longer in progress');
}

t/test-progress.t  view on Meta::CPAN

    ok($response1->is_success, 'Two progress meters with the same name and same pid pass');
    like($response1->content, qr/^Progress status test3 already exists/,
        'two unfinished progress meters with the same name dies');

    my $response2 = $app->request( GET '/_progress_status/test3' );
    my $data = $json->decode($response2->decoded_content);
    is($data->{total}, 200, 'Total is overriden');
}

{
    ## Test progress status with automatic ID
    my $response1 = $app->request(GET '/test_progress_with_progress_id?progress_id=1000');
    ok($response1->is_success, '200 response for progress with progress id');

    my $response2 = $app->request(GET '/_progress_status/1000');
    ok($response2->is_success, 'Get good response from progressstatus');
    my $data = $json->decode($response2->decoded_content);
    is($data->{total}, 100, 'Get a sensible response');
}


done_testing(17); # number of tests + Test::Warnings

 view all matches for this distribution


Dancer2-Plugin-RPC

 view release on metacpan or  search on metacpan

t/100-xmlrpc.t  view on Meta::CPAN

<params/>
</methodCall>
        EOXML
    );
    my $response = $tester->request($request);
    my $value = $p->parse($response->decoded_content)->value->value;
    is_deeply(
        $value,
        'pong',
        "ping"
    ) or diag(explain($value));

t/100-xmlrpc.t  view on Meta::CPAN

        EOXML
    );
    my $response = $tester->request($request);
    is($response->status_line, '200 OK', "OK response");

    my $methods = $p->parse($response->decoded_content)->value->value;
    is_deeply(
        $methods,
        {
            '/endpoint' => [qw/
                methodList

 view all matches for this distribution


Dancer2-Plugin-Redis

 view release on metacpan or  search on metacpan

t/Util.pm  view on Meta::CPAN

    my $req = HTTP::Request->new( $method => "http://localhost$uri" );
    my $res = $cb->($req);
    subtest "$method $uri" => sub {
      plan tests => $expected_response ? 2 : 1;
      ok( $res->is_success, "request successful for $method $uri" );
      like( $res->decoded_content, $expected_response, "expected response content for $method $uri" )
        if $expected_response;
    };
    return;
  };
  test_psgi( $app, $client );

 view all matches for this distribution


Dancer2-Plugin-WebSocket

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/WebSocket.pm  view on Meta::CPAN

=over

=item serializer

If serializer is set to a C<true> value, messages will be assumed to be JSON
objects and will be automatically encoded/decoded using a L<JSON::MaybeXS>
serializer.  If the value of C<serializer> is a hash, it'll be passed as
arguments to the L<JSON::MaybeXS> constructor.

    plugins:
        WebSocket:

 view all matches for this distribution


Dancer2-Serializer-JSONMaybeXS

 view release on metacpan or  search on metacpan

t/deserialize.t  view on Meta::CPAN

    };
}

note "Decoding of mixed route and deserialized body params"; {
    # Check integers from request body remain integers
    # but route params get decoded.
    test_psgi $app, sub {
        my $cb = shift;

        my @req_params = (
            "/from/D\x{c3}\x{bc}sseldorf", # /from/d%C3%BCsseldorf

t/deserialize.t  view on Meta::CPAN


        # Watch out for hash order randomization..
        is_deeply(
            $r->content,
            '["population",592393,"town","'."D\x{c3}\x{bc}sseldorf".'"]',
            "Integer from JSON body remains integer and route params decoded",
        );
    };
}

# Check body is deserialized on PATCH and DELETE.

 view all matches for this distribution


Dancer2-Session-DBIC

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN


    [BUG FIXES]

    * Fix generating new sessions for every request
      (Peter Mottram, Rory Zweistra, GH #9).
    * Use decoded_content instead of content in UTF-8 tests
      (Peter Mottram, GH #8).

    [TESTS]

    * Stop Test::More complaining about wide chars in print (Peter Mottram).

 view all matches for this distribution


Dancer2-Session-DatabasePlugin

 view release on metacpan or  search on metacpan

t/Dancer2-Session-DatabasePlugin.t  view on Meta::CPAN

  {
    my $req=GET '/session/fetch',Cookie=>$cookie;
    my $res  = $test->request( $req );
    cmp_ok($res->code,'==',200,'Should get a 200');
    ok($cookie=$res->header($h),'Should have a cookie!');
    cmp_ok($res->decoded_content,'eq','I am a little teapot.');
    cmp_ok(keys(%{$SESSION->sth_cache}),'>',0,'Should have more than 0 statement handles');
  
  }
  {
    my $req=GET '/session/fetch',Cookie=>$cookie;
    my $res  = $test->request( $req );
    cmp_ok($res->code,'==',200,'Should get a 200');
    ok($cookie=$res->header($h),'Should have a cookie!');
    cmp_ok($res->decoded_content,'eq','I am a little teapot.');
    cmp_ok(keys(%{$SESSION->sth_cache}),'>',0,'Should have more than 0 statement handles');
    my @keys=keys %{$saved};
    is_deeply($saved,$SESSION->sth_cache,'Should have the same sth cache in both places') or die "Cannot continue testing";
    ok(join('',@{$saved}{@keys}) eq join('',@{$SESSION->sth_cache}{@keys}),'Statement handles should be cached') or die "cannot continue testing";

t/Dancer2-Session-DatabasePlugin.t  view on Meta::CPAN

  {
    my $req=GET '/session/fetch',Cookie=>$cookie;
    my $res  = $test->request( $req );
    cmp_ok($res->code,'==',200,'Should get a 200');
    ok($cookie=$res->header($h),'Should have a cookie!');
    cmp_ok($res->decoded_content,'eq','I am a little teapot.');
    cmp_ok(keys(%{$SESSION->sth_cache}),'>',0,'Should have more than 0 statement handles');
  }
  {
    my $req=GET 'disconnect2',Cookie=>$cookie;
    my $res  = $test->request( $req );

 view all matches for this distribution


Dancer2-Session-Memcached

 view release on metacpan or  search on metacpan

lib/Dancer2/Session/Memcached.pm  view on Meta::CPAN

    $self->_flush( $new_id, $self->_retrieve( $old_id ) );
    $self->_destroy( $old_id );
}

# reject anything where the first two bytes are below \x20 once
# Base64 decoded, ensuring Storable doesnt attempt to thaw such cruft.
sub validate_id {
    $_[1] =~ m/^[I-Za-z0-9_\-~][A-Za-z0-9_\-~]+$/;
}

1;

 view all matches for this distribution


Dancer2-Session-Redis

 view release on metacpan or  search on metacpan

t/Util.pm  view on Meta::CPAN

    my $res = $cb->($req);
    $jar->extract_cookies($res);
    subtest "$method $uri" => sub {
      plan tests => $expected_response ? 2 : 1;
      ok( $res->is_success, "request successful for $method $uri" );
      like( $res->decoded_content, $expected_response, "expected response content for $method $uri" )
        if $expected_response;
    };
    return;
  };
  test_psgi( $app, $client );

 view all matches for this distribution


Dash

 view release on metacpan or  search on metacpan

share/assets/dash_core_components/async~markdown.js.map  view on Meta::CPAN

{"version":3,"sources":["webpack:///./node_modules/is-whitespace-character/index.js","webpack:///./node_modules/xtend/immutable.js","webpack:///./node_modules/trim/index.js","webpack:///./node_modules/is-decimal/index.js","webpack:///./node_modules/u...

 view all matches for this distribution


Data-Apache-mod_status

 view release on metacpan or  search on metacpan

lib/Data/Apache/mod_status.pm  view on Meta::CPAN

    my $response = $ua->get($url);
    die 'failed to fetch "', $url, '" - '.$response->status_line
        if $response->is_error();
    
    # tidy mod_status page to be xhtml document
    return $response->decoded_content;
}

"Zed's Dead, baby";


 view all matches for this distribution


Data-BISON

 view release on metacpan or  search on metacpan

lib/Data/BISON/Decoder.pm  view on Meta::CPAN


Create a new Data::BISON::Encoder.

=item C<< decode >>

Decode BISON serialized data. The data to be decoded may optionally have
been yEnc encoded; C<decode> will detect this and perform the
appropriate decoding.

The returned value is a scalar, hash reference or array reference.

 view all matches for this distribution


Data-Binary

 view release on metacpan or  search on metacpan

lib/Data/Binary.pm  view on Meta::CPAN

	my $length = length($string);
	my $odd = ($string =~ tr/\x01\x02\x03\x04\x05\x06\x07\x09\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f//d);

	# Detecting >=128 and non-UTF-8 is interesting. Note that all UTF-8 >=128 has several bytes with
	# >=128 set, so a quick test is possible by simply checking if any are >=128. However, the count
	# from that is typically wrong, if this is binary data, it'll not have been decoded. So we do this
	# in two steps.

	my $copy = $string;
	if (($copy =~ tr[\x80-\xff][]d) > 0) {
		my $modified = decode_utf8($string, Encode::FB_DEFAULT);

 view all matches for this distribution


Data-BitStream-XS

 view release on metacpan or  search on metacpan

examples/integercoding.pl  view on Meta::CPAN

  $str = encode_delta(8);    # die unless $str eq '00100000';
  $str = encode_omega(8);    # die unless $str eq '1110000';
  $str = encode_fib(8);      # die unless $str eq '000011';

The C<decode_> methods take a single binary string as input and produce an
unsigned integer output decoded from the bit encoding.

  $n = decode_unary('000000000000001');  # die unless $n == 14;
  $n = decode_gamma('0001110');          # die unless $n == 14;
  $n = decode_delta('00100110');         # die unless $n == 14;
  $n = decode_omega('1111100');          # die unless $n == 14;

 view all matches for this distribution


Data-BitStream

 view release on metacpan or  search on metacpan

examples/compression-code.pl  view on Meta::CPAN

  my $e1 = int(tv_interval($s1)*1_000_000);
  my $s2 = [gettimeofday];
  @list = $stream->get_unary(-1);
  my $e2 = int(tv_interval($s2)*1_000_000);
  $listn = scalar @list;
  printf "Slurped $listn numbers in %.1f ms, decoded in %.1f ms\n", $e1/1000,$e2/1000;
}

# average value
my $avg = int( ((sum @list) / $listn) + 0.5);
# bytes required in fixed size (FOR encoding)

 view all matches for this distribution


Data-CTable

 view release on metacpan or  search on metacpan

CTable.pm  view on Meta::CPAN


=over 4 

=item _ReturnMap       = 1 unless exists

_ReturnMap says that returns embedded in fields should be decoded on
read() and encoded again on write().  The industry-standard encoding
for embedded returns is ^K (ascii 11 -- but see next setting to change
it).  This defaults to true but can be turned off if you want data
untouched by read().  This setting has no effect on data files where
no fields contain embedded returns.  However, it is vital to leave
this option ON when writing any data file whose fields could contain
embedded returns -- if you have such data and call write() with
_ReturnMap turned off, the resulting file will be an invalid Merge/CSV
file and might not be re-readable.

When these fields are decoded on read(), encoded returns are converted
to C<"\n"> in memory, whatever its interpretation may be on the current
platform (\x0A on Unix or DOS; \x0D on MacPerl).

IMPORTANT NOTE: When these fields are encoded by write(), any
occurrence of the current _LineEnding being used to write the file is

 view all matches for this distribution


Data-ChipsChallenge

 view release on metacpan or  search on metacpan

lib/Data/ChipsChallenge.pm  view on Meta::CPAN


Given the encoded level password in raw binary (4 bytes followed by a null byte),
this function returns the 4 ASCII byte password in clear text. This is the password
you'd type into Chip's Challenge.

Passwords are decoded by XORing the values in the raw binary by hex C<0x99>,
if you're curious.

=cut

sub decode_password {

 view all matches for this distribution


Data-CompactReadonly

 view release on metacpan or  search on metacpan

lib/Data/CompactReadonly.pm  view on Meta::CPAN

This is not yet implemented for Arrays.

=back

Returns the "root node" of the database. If that root node is a number, some
piece of text, True, False, or Null, then it is decoded and the value returned. Otherwise an
object (possibly a tied object) representing an Array or a Dictionary is returned.

=head1 OBJECTS

If you asked for normal objects to be returned instead of tied objects, then

lib/Data/CompactReadonly.pm  view on Meta::CPAN

=head1 UNSUPPORTED PERL TYPES

Globs, Regexes, References (except to Arrays and Dictionaries).

Booleans are only supported on perl version 5.35.7 or later. On earlier perls, a
Boolean in the database will be decoded as a true or false I<value>, but its type
will be numeric or string. And a older perls will never write a True or False node
to the database, they'll always write numbers or strings with true/false values,
which other implementations will decode as numbers or strings.

=head1 BUGS/FEEDBACK

 view all matches for this distribution


Data-Decode

 view release on metacpan or  search on metacpan

lib/Data/Decode.pm  view on Meta::CPAN

  use Data::Decode;

  my $decoder = Data::Decode->new(
    strategy => Data::Decode::Encode::Guess->new()
  );
  my $decoded = $decoder->decode($data);

=head1 DESCRIPTION

WARNING: Alpha grade software.

lib/Data/Decode.pm  view on Meta::CPAN


=item strategy

Required. Takes in the object that encapsulates the actual decoding logic.
The object must have a method named "decode", which takes in a reference
to the Data::Decode object and a string to be decoded. An optional third
parameter may be provided to specify any hints that could be used to figure
out what to do. 

  sub decode {
    my ($self, $decoder, $string, $hints) = @_;
    # $decoder = Data::Decode object
    # $string  = a scalar to be decoded
    # $hints   = a hashref of hints
  }

=back

 view all matches for this distribution


Data-Dump-AutoEncode

 view release on metacpan or  search on metacpan

t/10_basic.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More tests => 5;

# encoded/decoded Japanese hiragana (a)
my $str  = "\x{3042}";
my $char = "\x{82}\x{A0}";
my $data = {str => $str, array => [$str]};
my $re   = qr/\\x\{[^\}]+\}/;

 view all matches for this distribution


Data-Dumper-AutoEncode

 view release on metacpan or  search on metacpan

lib/Data/Dumper/AutoEncode.pm  view on Meta::CPAN

=head2 BEFORE_HOOK / AFTER_HOOK

Set code ref for hooks which excuted around encoding

    $Data::Dumper::AutoEncode::BEFORE_HOOK = sub {
        my $value = $_[0]; # decoded
        $value =~ s/\x{2019}/'/g;
        return $value;
    };

    $Data::Dumper::AutoEncode::AFTER_HOOK = sub {

lib/Data/Dumper/AutoEncode.pm  view on Meta::CPAN

        return $value;
    };

=head2 CHECK_ALREADY_ENCODED : false

If you set this option true value, check a target before encoding. And do encode in case of decoded value.

=head2 DO_NOT_PROCESS_NUMERIC_VALUE : true

By default, numeric values are ignored (do nothing).

 view all matches for this distribution


Data-Dumper-Interp

 view release on metacpan or  search on metacpan

lib/Data/Dumper/Interp.pm  view on Meta::CPAN

C<< use open IO => ':locale'; >> or otherwise arrange to
encode the output for your terminal.
You'll also want C<< use utf8; >> if your Perl source
contains characters outside the ASCII range.

Undecoded binary octets (e.g. data read from a 'binmode' file)
will still be escaped as individual bytes.

=item *

Depending on options, spaces·may·be·shown·visibly

 view all matches for this distribution


Data-Edit-Xml-Xref

 view release on metacpan or  search on metacpan

lib/Data/Edit/Xml/Xref.pm  view on Meta::CPAN

 {my ($xref, $file, $href) = @_;                                                # Cross referencer, file containing reference, reference

  my $fileExists = sub                                                          # Check that the specified file exists by looking for the topic id which L<Dita> guarantees will exist
   {my ($file) = @_;                                                            # File to check
    return 1 if $xref->topicIds->{$file};                                       # File exists
    my $decodedTarget = wwwDecode($file);                                       # Decode file name by expanding % signs to see if we can get a match
    return 2 if $xref->topicIds->{$decodedTarget};                              # File exists after decoding % signs
    return 3 if -e $file;                                                       # Images
    undef                                                                       # Cannot locate file
   };

  if ($href =~ m(#))                                                            # Full Dita href

 view all matches for this distribution


( run in 0.448 second using v1.01-cache-2.11-cpan-26ccb49234f )