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


Email-MIME-XMTP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

13
14
15
16
17
18
19
20
21
22
23
          Content-Type header; it is now default to UTF-8.
 
0.40    Thu Aug 18 17:53:06 CEST 2005
 
        - fixed nusty bug when serializing to XML headers combined with body. Make
          sure that headers as decoded and body is a valid UTF-8 string into XML.
 
0.39    Thu Aug 18 01:44:46 CEST 2005
 
        - fixed bug when Content-Type is not specified; and default to text/plain
          (and do not base64-encode body text)

 view all matches for this distribution


Email-Outlook-Message

 view release on metacpan or  search on metacpan

lib/Email/Outlook/Message.pm  view on Meta::CPAN

405
406
407
408
409
410
411
412
413
414
415
sub _create_mime_plain_body {
  my $self = shift;
  my $charset = $self->_body_plain_character_set;
  my $body_str = $self->{BODY_PLAIN};
  if ($charset ne "UTF-8") {
    # In this case, the body is a string of octets and needs to be decoded.
    $body_str = Encode::decode($charset, $body_str);
  }
  return Email::MIME->create(
    attributes => {
      content_type => "text/plain",

 view all matches for this distribution


Email-Simple

 view release on metacpan or  search on metacpan

lib/Email/Simple/Header.pm  view on Meta::CPAN

187
188
189
190
191
192
193
194
195
196
#pod
#pod =method header
#pod
#pod This method just calls C<header_raw>.  It's the older name for C<header_raw>,
#pod but it can be a problem because L<Email::MIME>, a subclass of Email::Simple,
#pod makes C<header> return the header's decoded value.
#pod
#pod =cut
 
sub _str_value { return ref $_[0] ? $_[0][0] : $_[0] }

lib/Email/Simple/Header.pm  view on Meta::CPAN

553
554
555
556
557
558
559
560
561
562
=head2 header
 
This method just calls C<header_raw>.  It's the older name for C<header_raw>,
but it can be a problem because L<Email::MIME>, a subclass of Email::Simple,
makes C<header> return the header's decoded value.
 
=head2 header_raw_set
 
  $header->header_raw_set($field => @values);

 view all matches for this distribution


Email-Stuffer-TestLinks

 view release on metacpan or  search on metacpan

lib/Email/Stuffer/TestLinks.pm  view on Meta::CPAN

71
72
73
74
75
76
77
78
79
80
my $response = shift;
 
return Future->fail("Response code was " . $response->code) if ($response->code !~ /^2\d\d/);
 
if ($response->content_type eq 'text/html') {
    my $dom = Mojo::DOM->new($response->decoded_content);
    if (my $title = $dom->at('title')) {
        return Future->fail("Page title contains text '$1'") if $title->text =~ /(error|not found)/i;
    }
}

 view all matches for this distribution


Embperl

 view release on metacpan or  search on metacpan

Changes.pod  view on Meta::CPAN

1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
     automaticly set status to 301.
   - setting http headers and <META HTTP-EQUIV=..> now works also
     in cgi mode.
   - Session Handling now also works in CGI mode (needs
     Apache::Session >= 1.04)
   - ACTION attribute of Formtag is now URL en/decoded. Spotted by
     Hartmut Palm.
 
=head1 1.2b9 (BETA) 10. Sept 1999
 
   - Fixed a problem with loading Apache::Session 1.01, when

 view all matches for this distribution


Emoji-NationalFlag

 view release on metacpan or  search on metacpan

lib/Emoji/NationalFlag.pm  view on Meta::CPAN

60
61
62
63
64
65
66
67
68
69
=head2 code2flag($iso_3166_1_alpha_2_code): Optional[NationalFlagEmoji]
 
This method returns national flag emoji if the supplied code (case insensitive) is valid, otherwise returns C<undef>
 
=head2 flag2code($decoded_national_flag_emoji): Optional[lc(CountryCodeAlpha-2)]
 
This method returns lower case of ISO 3166-1 alpha-2 country code if the supplied emoji is valid, otherwise returns C<undef>
 
=head1 AUTHOR

 view all matches for this distribution


Encode-Argv

 view release on metacpan or  search on metacpan

lib/Encode/Argv.pm  view on Meta::CPAN

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Encode::Argv - Automatically Mess With @ARGV's Encoding
 
=head1 SYNOPSIS
 
  use Encode::Argv ('cp932');
  # Now @ARGV is decoded unicode characters, decoded from cp932
 
  use Encode::Argv ('cp932' => 'euc-jp');
  # Now @ARGV is encoded into euc-jp after being decoded from cp932
 
  use Encode::Argv;
  # Now @ARGV is decoded from whatever Term::Encoding thinks you are
  # using on your terminal.
 
=head1 DESCRIPTION
 
I saw L<http://search.cpan.org/dist/Sjis|Sjis.pm> and L<http://www.aritia.org/hizumi/perl/perlwin.html|this>, and thought, "Well, I can't fix /all/ of their

 view all matches for this distribution


Encode-Base32-Crockford

 view release on metacpan or  search on metacpan

lib/Encode/Base32/Crockford.pm  view on Meta::CPAN

165
166
167
168
169
170
171
172
173
174
175
or
 
    use Encode::Base32::Crockford qw(base32_decode); # your choice of methods
     
    my $decoded = base32_decode_with_checksum("16JD");
    my $encoded = base32_encode_with_checksum(1234);
 
=head1 METHODS
 
=head2 base32_encode

 view all matches for this distribution


Encode-Base32-GMP

 view release on metacpan or  search on metacpan

lib/Encode/Base32/GMP.pm  view on Meta::CPAN

171
172
173
174
175
176
177
178
179
180
181
  base32hex: [0123456789ABCDEFGHIJKLMNOPQRSTUV]
  gmp:       [0123456789ABCDEFGHIJKLMNOPQRSTUV]
 
The encode_base32, decode_base32 and md5_base32 methods support an alphabet
parameter which can be set to the supported alphabets to indicate the value
to be encoded or decoded:
 
  [qw/crockford rfc4648 base32hex zbase32 gmp/]
 
This module functions similarly to L<Encode::Base58::GMP> with Base32 being
ideal for case-insensitive encoding and Base58 being ideal for case-sensitive

 view all matches for this distribution


Encode-Base58-BigInt

 view release on metacpan or  search on metacpan

lib/Encode/Base58/BigInt.pm  view on Meta::CPAN

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
sub decode_base58 {
    my $str = shift;
    $str =~ tr/0OlI/DD11/;
    $str =~ $reg or croak "Invalid Base58";
 
    my $decoded = Math::BigInt->new(0);
    my $multi   = Math::BigInt->new(1);
    my $base    = @$chars;
 
    while (length $str > 0) {
        my $digit = chop $str;
        $decoded->badd($multi->copy->bmul($map->{$digit}));
        $multi->bmul($base);
    }
 
    "$decoded";
}
 
1;
__END__

lib/Encode/Base58/BigInt.pm  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
82
=head1 SYNOPSIS
 
  use Encode::Base58::BigInt;
  my $bigint  = '9235113611380768826';
  my $encoded = encode_base58($bigint);
  my $decoded = decode_base58($short); # decoded is bigint string
 
 
=head1 DESCRIPTION
 
Encode::Base58::BigInt is a base58 encoder/decoder implementation in Perl.

 view all matches for this distribution


Encode-Base58-GMP

 view release on metacpan or  search on metacpan

lib/Encode/Base58/GMP.pm  view on Meta::CPAN

147
148
149
150
151
152
153
154
155
156
GMP Alphabet: [0-9A-Za-v]
 
The encode_base58, decode_base58 and md5_base58 methods support an alphabet
parameter which can be set to the supported alphabets ['bitcoin', 'flickr',
'gmp'] to indicate the value to be encoded or decoded.
 
=head2 Requirements
 
This module requires GMP 4.2.0 and above. Prior versions are limited to Base36.

 view all matches for this distribution


Encode-Base58

 view release on metacpan or  search on metacpan

lib/Encode/Base58.pm  view on Meta::CPAN

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
}
 
sub decode_base58 {
    my $str = shift;
 
    my $decoded = 0;
    my $multi   = 1;
    my $base    = @alpha;
 
    while (length $str > 0) {
        my $digit = chop $str;
        $decoded += $multi * $alpha{$digit};
        $multi   *= $base;
    }
 
    return $decoded;
}
 
1;
__END__

 view all matches for this distribution


Encode-Bootstring

 view release on metacpan or  search on metacpan

t/encodedecode.t  view on Meta::CPAN

10
11
12
13
14
15
my $BS = new Encode::Bootstring();
my $raw = 'Búlgarska';
my $enc = $BS->encode( $raw );
my $dec = $BS->decode( $enc );
ok( $enc ne $dec, 'not encoded' );
ok( $dec eq $raw, 'decoded same as original' );

 view all matches for this distribution


Encode-Detect

 view release on metacpan or  search on metacpan

Detect.pm  view on Meta::CPAN

50
51
52
53
54
55
56
57
58
59
60
61
62
sub decode ($$;$) {
    my ($self, $octets, $check) = @_;
    my $charset = detect($octets) || 'Windows-1252';
    my $e = find_encoding($charset) or die "Unknown encoding: $charset";
    my $decoded = $e->decode($octets, $check || 0);
    $_[1] = $octets if $check;
    return $decoded;
}
 
1;
 
__END__

 view all matches for this distribution


Encode-Escape

 view release on metacpan or  search on metacpan

t/Encode-Escape-ASCII.t  view on Meta::CPAN

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$string = "\a\b\e\f\n\r\t\\\"\$\@";
$escaped = "\\a\\b\\e\\f\\n\\r\\t\\\\\\\"\\\$\\\@";
 
is      $string,
        (decode 'ascii-escape', $escaped),
        'decoded character escape sequences';
is      $escaped,
        (encode 'ascii-escape', $string),
        'encoded character escape sequences';
 
$string_oct = "\0\00\000\11\011\100";
$escaped_oct = "\\0\\00\\000\\11\\011\\100";
 
is      $string_oct,
        (decode 'ascii-escape', $escaped_oct),
        'decoded octal escape sequences';
 
$string_hex = "\x09\x47\x57\x67\x77";
$escaped_hex = "\\x09\\x47\\x57\\x67\\x77";
 
is      $string_hex,
        (decode 'ascii-escape', $escaped_hex),
        'decoded hex escape sequences';
 
$string_non_printing
        = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e" .
          "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e" .
          "\x7f";

t/Encode-Escape-ASCII.t  view on Meta::CPAN

49
50
51
52
53
54
55
56
57
      "\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\e\\x1c\\x1d\\x1e" .
          "\\x7f";
 
is $string_non_printing,
        (decode 'ascii-escape', $escaped_non_printing),
        'decoded non-printing characters';
is $escaped_non_printing,
        (encode 'ascii-escape', $string_non_printing),
        'encoded non-printing characters';

 view all matches for this distribution


Encode-Float

 view release on metacpan or  search on metacpan

lib/Encode/Float.pm  view on Meta::CPAN

27
28
29
30
31
32
33
34
35
36
37
38
39
for (my $i = 0 ; $i < 10 ; $i++)
{
  my $float = (.5 - rand) * 10**int(10 - 20 * rand);
  $float = 0 if $i == 0;
  my $encoded = $encoder->encode($float);
  my $decoded = $encoder->decode($encoded);
  my $error   = $encoder->getRelativeDifference($float, $decoded);
  push @list, [ $encoded, $float, $decoded, $error ];
}
@list = sort { $a->[0] cmp $b->[0] } @list;
foreach (@list)
{
  print join(',', @$_) . "\n";

 view all matches for this distribution


Encode-Korean

 view release on metacpan or  search on metacpan

t/Encode-Korean-HSR.t  view on Meta::CPAN

83
84
85
86
87
88
89
90
91
92
93
94
95
96
                          "anj.a anja " .
                          "anj.ja anjja " .
                          "anjjja" ;
         
my $encoded_ccs = encode 'hsr', $str_ccs;
my $decoded_ccs = decode 'hsr', $hsr_ccs;
my $decoded_ccs_smart_sep = decode 'hsr', $hsr_ccs_smart_sep;
 
is $encoded_ccs, $hsr_ccs, 'encoded complex consonants group';
is $decoded_ccs, $str_ccs, 'decoded complex consonants group';
is $decoded_ccs_smart_sep, $str_ccs, 'decoded complex consonants group with smart sep';
 
is $encoded_ccs, (encode 'hsr', $decoded_ccs), 'encode ($enc, $decoded)';
is $decoded_ccs, (decode 'hsr', $encoded_ccs), 'decode ($enc, $encoded)';

 view all matches for this distribution


Encode-Locale

 view release on metacpan or  search on metacpan

lib/Encode/Locale.pm  view on Meta::CPAN

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
=item decode_argv( Encode::FB_CROAK )
 
This will decode the command line arguments to perl (the C<@ARGV> array) in-place.
 
The function will by default replace characters that can't be decoded by
"\x{FFFD}", the Unicode replacement character.
 
Any argument provided is passed as CHECK to underlying Encode::decode() call.
Pass the value C<Encode::FB_CROAK> to have the decoding croak if not all the
command line arguments can be decoded.  See L<Encode/"Handling Malformed Data">
for details on other options for CHECK.
 
=item env( $uni_key )
 
=item env( $uni_key => $uni_value )

lib/Encode/Locale.pm  view on Meta::CPAN

260
261
262
263
264
265
266
267
268
269
270
Interface to get/set environment variables.  Returns the current value as a
Unicode string. The $uni_key and $uni_value arguments are expected to be
Unicode strings as well.  Passing C<undef> as $uni_value deletes the
environment variable named $uni_key.
 
The returned value will have the characters that can't be decoded replaced by
"\x{FFFD}", the Unicode replacement character.
 
There is no interface to request alternative CHECK behavior as for
decode_argv().  If you need that you need to call encode/decode yourself.
For example:

 view all matches for this distribution


Encode-Positive-Digits

 view release on metacpan or  search on metacpan

lib/Encode/Positive/Digits.pm  view on Meta::CPAN

54
55
56
57
58
59
60
61
62
63
64
"number of decoding digits supplied($b) too few, must be at least 2";
 
my @n = split //, $number;
my $n = @n;
 
for(1..$n)                                                                    # Convert each digit to be decoded with its decimal equivalent
 {my $d = $n[$_-1];
  my $i = index($digits, $d);
  $i < 0 and confess "Invalid digit \"$d\" in number $number at position $_";
  $n[$_-1] = $i;
 }

lib/Encode/Positive/Digits.pm  view on Meta::CPAN

103
104
105
106
107
108
109
110
111
112
ok   5 == Encode::Positive::Digits::decode("101", "01");
 
 ok "hello world" eq Encode::Positive::Digits::encode(4830138323689, " abcdefghlopqrw");
 ok 4830138323689 == Encode::Positive::Digits::decode("hello world", " abcdefghlopqrw");
 
The numbers to be encoded or decoded can be much greater than 2**64 via support
from L<Math::BigInt>, such numbers should be placed inside strings to avoid
inadvertent truncation.
 
  my $n = '1'.('0'x999).'1';

 view all matches for this distribution


Encode-Repair

 view release on metacpan or  search on metacpan

lib/Encode/Repair.pm  view on Meta::CPAN

96
97
98
99
100
101
102
103
104
105
106
# prints: beta: β
print repair_double("beta: \xc4\xaa\xc2\xb2\n", {via => 'Latin-7'});
 
 
# Advanced usage
# assumes you have a sample text both correctly decoded in a
# character string, and as a wrongly encoded buffer
 
use Encode::Repair qw(repair_encoding learn_recoding);
use charnames qw(:full);
binmode STDOUT, ':encoding(UTF-8)';

lib/Encode/Repair.pm  view on Meta::CPAN

143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
and was encoded as UTF-8 again. The other encoding defaults to ISO-8859-1 aka
Latin-1, and can be overridden with the C<via> option:
 
    my $repaired = repair_double($buffer, {via => 'ISO-8859-2' });
 
It expects an octet string as input, and returns a decoded character string.
 
=item learn_recoding
 
Given a sample of text twice, once correctly decoded and once mistreated,
attemps to find a sequence of encoding and decoding that turns the mistreated
text into the correct form.
 
    my $coding_pattern = learn_recoding(
        from        => $mistreated_buffer,

 view all matches for this distribution


Encode-Safename

 view release on metacpan or  search on metacpan

lib/Encode/Safename.pm  view on Meta::CPAN

36
37
38
39
40
41
42
43
44
45
46
    use Encode qw(decode encode);
    use Encode::Safename;
 
    $encoded = encode('safename', 'Foo Bar Baz.txt');
    # $encoded is now '{f}oo_{b}ar_{b}az.txt'
    $decoded = decode('safename', $encoded);
    # $decoded is now 'Foo Bar Baz.txt'
 
=head1 DESCRIPTION
 
A filename is encoded as follows:

 view all matches for this distribution


Encode-Simple

 view release on metacpan or  search on metacpan

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

48
49
50
51
52
53
54
55
56
57
58
=head1 DESCRIPTION
 
This module provides simple in-place decoding of command-line arguments in the global array
L<@ARGV|perlvar/"@ARGV">. As with most input and output, command-line arguments are provided to the
script in bytes, and must be decoded to characters before performing string operations like
C<length> or regex matches.
 
The C<-CA> switch for Perl performs a similar function, but this has some deficiencies. It assumes
via the C<:utf8> internal layer that the arguments are valid UTF-8 bytes, ignoring invalid Unicode,
and even resulting in malformed strings if the bytes do not happen to be well-formed UTF-8. This

 view all matches for this distribution


Encode-Wechsler

 view release on metacpan or  search on metacpan

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

11
12
13
14
15
16
17
18
19
20
21
is $wechsler->decode( 'xq4_27deee6' ),
".**....
**.****
.******
..****.
", 'xq4_27deee6 decoded correctly';
 
is $wechsler->decode( 'xs31_0ca178b96z69d1d96' ),
"...**.**.
..*.*.*.*
.*..*...*

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

23
24
25
26
27
28
29
30
31
32
33
.........
.*****...
*.....*..
*.*.*.*..
.**.**...
", 'xs31_0ca178b96z69d1d96 decoded correctly';
 
is $wechsler->decode( 'xp30_w33z8kqrqk8zzzx33' ),
"..**...
..**...
.......

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

49
50
51
52
53
54
55
56
57
58
59
.......
.......
...**..
...**..
.......
", 'xp30_w33z8kqrqk8zzzx33 decoded correctly';
 
is $wechsler->decode( 'xp2_31a08zy0123cko' ),
"**........
*.*.......
..........

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

62
63
64
65
66
67
68
69
70
71
....*.*...
.....**...
.......**.
.......*.*
........**
", 'xp2_31a08zy0123cko decoded correctly';
 
#is $wechsler->decode( 'xp30_ccx8k2s3yagzy3103yaheha4xcczyk1' ),
#"
#", 'xp30_ccx8k2s3yagzy3103yaheha4xcczyk1 decoded correctly';

 view all matches for this distribution


Encode-ZapCP1252

 view release on metacpan or  search on metacpan

lib/Encode/ZapCP1252.pm  view on Meta::CPAN

289
290
291
292
293
294
295
296
297
298
299
300
  fix_cp1252; # Modify $_ in-place.
  my $zapped = zap_cp1252; # Copy $_ and return zapped
  my $fixed = zap_cp1252; # Copy $_ and return fixed
 
In Perl 5.8.8 and higher, the conversion will work even when the string is
decoded to Perl's internal form (usually via C<decode 'ISO-8859-1', $text>) or
the string is encoded (and thus simply processed by Perl as a series of
bytes). The conversion will even work on a string that has not been decoded
but has had its C<utf8> flag flipped anyway (usually by an injudicious use of
C<Encode::_utf8_on()>. This is to enable the highest possible likelihood of
removing those CP1252 gremlins no matter what kind of processing has already
been executed on the string.

 view all matches for this distribution


Encode

 view release on metacpan or  search on metacpan

Encode.pm  view on Meta::CPAN

505
506
507
508
509
510
511
512
513
514
Do not use it for data exchange.
Unless you want Perl's older "lax" mode, prefer
C<$string = decode("UTF-8", $octets [, CHECK])>.
 
Equivalent to C<$string = decode("utf8", $octets [, CHECK])>.
The sequence of octets represented by $octets is decoded
from (loose, not strict) utf8 into a sequence of logical characters.
Because not all sequences of octets are valid not strict utf8,
it is quite possible for this function to fail.
For CHECK, see L</"Handling Malformed Data">.

Encode.pm  view on Meta::CPAN

707
708
709
710
711
712
713
714
715
716
717
For encodings that are implemented by the C<Encode::XS> module, C<CHECK> C<==>
C<Encode::FB_PERLQQ> puts C<encode> and C<decode> into C<perlqq> fallback mode.
 
When you decode, C<\xI<HH>> is inserted for a malformed character, where
I<HH> is the hex representation of the octet that could not be decoded to
utf8.  When you encode, C<\x{I<HHHH>}> will be inserted, where I<HHHH> is
the Unicode code point (in any number of hex digits) of the character that
cannot be found in the character repertoire of the encoding.
 
The HTML/XML character reference modes are about the same. In place of

Encode.pm  view on Meta::CPAN

752
753
754
755
756
757
758
759
760
761
762
  $ascii = encode("ascii", $utf8, sub{ sprintf "<U+%04X>", shift });
 
Acts like C<FB_PERLQQ> but U+I<XXXX> is used instead of C<\x{I<XXXX>}>.
 
Fallback for C<decode> must return decoded string (sequence of characters)
and takes a list of ordinal values as its arguments. So for
example if you wish to decode octets as UTF-8, and use ISO-8859-15 as
a fallback for bytes that are not valid UTF-8, you could write
 
    $str = decode 'UTF-8', $octets, sub {

 view all matches for this distribution


Encoding-BER

 view release on metacpan or  search on metacpan

lib/Encoding/BER.pm  view on Meta::CPAN

35
36
37
38
39
40
41
42
43
44
45
Unlike many other BER encoder/decoders, this module uses tree structured data
as the interface to/from the encoder/decoder.
 
The decoder does not require any form of template or description of the
data to be decoded. Given arbitrary BER encoded data, the decoder produces
a tree shaped perl data structure from it.
 
The encoder takes a perl data structure and produces a BER encoding from it.
     
=head1 METHODS

lib/Encoding/BER.pm  view on Meta::CPAN

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
    # example: warn for warnings
    warn => sub{ warn "how odd! $_[1]\n" }
     
 
=item decoded_callback
 
coderef called for every element decoded. will be called with 2 parameters,
the Encoding::BER object, and the decoded data. [see DECODED DATA]
 
    # example: bless decoded results into a useful class
    decoded_callback => sub{ bless $_[1], MyBER::Result }
     
=item debug
 
boolean. if true, large amounts of useless gibberish will be sent to stderr regarding
the encoding or decoding process.

lib/Encoding/BER.pm  view on Meta::CPAN

1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
    $result->{type}     = $typdat;
    $result->{tagnum}   = $tagnum;
    $result->{identval} = $typval;
     
    if( my $c = $me->{decoded_callback} ){
        $result = $c->( $me, $result ) || $result# make sure the brain hasn't fallen out
    }
    return( $result, $tlen );
}

 view all matches for this distribution


Erlang-Parser

 view release on metacpan or  search on metacpan

t/basic.t  view on Meta::CPAN

756
757
758
759
760
761
762
763
764
765
766
%% @doc Yet another JSON (RFC 4627) library for Erlang. mochijson2 works
%%      with binaries as strings, arrays as lists (without an {array, _})
%%      wrapper and it only knows how to decode UTF-8 (and ASCII).
%%
%%      JSON terms are decoded as follows (javascript -> erlang):
%%      <ul>
%%          <li>{"key": "value"} ->
%%              {struct, [{&lt;&lt;"key">>, &lt;&lt;"value">>}]}</li>
%%          <li>["array", 123, 12.34, true, false, null] ->
%%              [&lt;&lt;"array">>, 123, 12.34, true, false, null]

 view all matches for this distribution


Etcd3

 view release on metacpan or  search on metacpan

lib/Etcd3/Role/Actions.pm  view on Meta::CPAN

132
133
134
135
136
137
138
139
140
141
142
    return $self;
}
 
=head2 get_value
 
returns single decoded value or the first.
 
=cut
 
sub get_value {
    my ($self)   = @_;

lib/Etcd3/Role/Actions.pm  view on Meta::CPAN

158
159
160
161
162
163
164
165
166
167
168
    'value' => 'bar',
    'create_revision' => '3',
    'key' => 'foo0'
  }
 
where key and value have been decoded for your pleasure.
 
=cut
 
sub all {
    my ($self)   = @_;

 view all matches for this distribution


Ethereum-RPC-Client

 view release on metacpan or  search on metacpan

lib/Ethereum/RPC/Contract.pm  view on Meta::CPAN

59
60
61
62
63
64
65
66
67
68
69
has max_priority_fee_per_gas => (is => 'rw');
 
has gas => (is => 'rw');
 
has contract_decoded => (
    is      => 'rw',
    default => sub { {} },
);
 
=head2 BUILD

lib/Ethereum/RPC/Contract.pm  view on Meta::CPAN

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
=cut
 
sub BUILD {
    my ($self) = @_;
    my @decoded_json = @{decode_json($self->contract_abi // "[]")};
 
    for my $json_input (@decoded_json) {
        if ($json_input->{type} =~ /^function|event|constructor$/) {
            push(@{$self->contract_decoded->{$json_input->{name} // $json_input->{type}}}, $json_input->{inputs});
        }
    }
 
    unless ($self->contract_decoded->{constructor}) {
        push(@{$self->contract_decoded->{constructor}}, []);
    }
 
    return;
 
}

lib/Ethereum/RPC/Contract.pm  view on Meta::CPAN

154
155
156
157
158
159
160
161
162
163
=cut
 
sub get_function_id {
    my ($self, $function_name, $params_size) = @_;
 
    my @inputs = @{$self->contract_decoded->{$function_name}};
 
    my $selected_data = first { (not $_ and not $params_size) or ($params_size and scalar @{$_} == $params_size) } @inputs;
 
    $function_name .= sprintf("(%s)", join(",", map { $_->{type} } grep { $_->{type} } @$selected_data));

lib/Ethereum/RPC/Contract.pm  view on Meta::CPAN

232
233
234
235
236
237
238
239
240
241
242
=cut
 
sub encode {
    my ($self, $function_name, $params) = @_;
 
    my $inputs = $self->contract_decoded->{$function_name}->[0];
 
    # no inputs
    return "" unless $inputs;
 
    my $offset = $self->get_function_offset($inputs);

 view all matches for this distribution


Eve

 view release on metacpan or  search on metacpan

lib/Eve/Json.pm  view on Meta::CPAN

18
19
20
21
22
23
24
25
26
27
28
    use Eve::Json;
 
    my $json = Eve::Json->new();
 
    my $json_string = $json->encode(reference => $reference);
    my $decoded_reference = $json->decode(string => $json_string);
 
=head1 DESCRIPTION
 
The B<Eve::Json> class adapts the functionality of the JSON::XS
module to provide JSON encoding and decoding features service.

lib/Eve/Json.pm  view on Meta::CPAN

74
75
76
77
78
79
80
81
82
83
    return $result;
}
 
=head2 B<decode()>
 
Decodes a JSON string and returns a reference to its decoded contents.
 
=head3 Arguments
 
=over 4

 view all matches for this distribution


( run in 0.562 second using v1.01-cache-2.11-cpan-0d8aa00de5b )