view release on metacpan or search on metacpan
lib/EBook/Tools/LZSS.pm view on Meta::CPAN
The eBookwise .IMP format typically compresses with 3 length bits.
Note that the actual length of the LZSS reference in bytes is greater
than the value stored in the length bits. The actual number of bytes
returned is the decoded length bits value plus C<maxuncoded> plus 1,
=item * C<offsetbits>
The number of bits used to encode the offset to a LZSS reference.
This also determines the size of the sliding window of reference data.
lib/EBook/Tools/LZSS.pm view on Meta::CPAN
spaces.
=item * C<windowstart>
The first byte position in the window that will be overwritten by
decoded text. If not specified, defaults to 0.
=item * C<maxuncoded>
The maximum number of uncoded bytes (?). This currently isn't used
for that purpose, but determines the actual length of a LZSS reference.
view all matches for this distribution
view release on metacpan or search on metacpan
Evas/Evas.xs view on Meta::CPAN
void
evas_object_text_style_pad_get(Evas_Object *obj, int *l, int *r, int *t, int *b)
int
evas_string_char_next_get(char *str, int pos, int *decoded)
int
evas_string_char_prev_get(char *str, int pos, int *decoded)
int
evas_string_char_len_get(char *str)
void
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-engines.t view on Meta::CPAN
use Encode;
use File::Basename;
use Scalar::Util qw(tainted);
my $encoded_text = "\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88";
my $decoded_text = decode_utf8($encoded_text);
my $unicode_notation = "\\u30C6\\u30B9\\u30C8";
my $invalid_text = "Invalid: \xFF";
my $sanitized_text = "Invalid: \xEF\xBF\xBD";
my $tainted_text = do {
open(my $in, dirname(__FILE__).'/data/tainted.txt') or die "$!: tainted.txt";
t/02-engines.t view on Meta::CPAN
close $in;
$tmp;
};
ok !Encode::is_utf8($encoded_text);
ok Encode::is_utf8($decoded_text);
isnt Encode::decode_utf8($invalid_text), $invalid_text;
ok tainted($tainted_text);
for my $engine (@EJS::Template::JSAdapter::SUPPORTED_ENGINES) {
eval {EJS::Template::JSAdapter->create($engine)};
t/02-engines.t view on Meta::CPAN
'C', 3, sub {'III'},
{str => 'F', num => 6, func => sub {'VI'}},
['G', 7, sub {'VII'}],
],
encoded => $encoded_text,
decoded => $decoded_text,
invalid => $invalid_text,
tainted => $tainted_text,
};
my $config = {engine => $engine};
t/02-engines.t view on Meta::CPAN
no strict 'refs';
my $sanitize_utf8 = ${"EJS::Template::JSAdapter::".$engine."::SANITIZE_UTF8"};
my $preserve_utf8 = ${"EJS::Template::JSAdapter::".$engine."::PRESERVE_UTF8"};
use strict 'refs';
my $decoded_text_expected = ($preserve_utf8 ? $decoded_text : $encoded_text);
my $invalid_text_expected = ($sanitize_utf8 ? $sanitized_text : $invalid_text);
ejs_test('<%= encoded %>', $encoded_text, $variables, $config);
ejs_test('<%= decoded %>', $decoded_text_expected, $variables, $config);
SKIP: {
if ($preserve_utf8) {
ejs_test("<%= '$unicode_notation' %>", $decoded_text, $variables, $config);
} else {
skip "$engine cannot preserve unicode", 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-basic.t view on Meta::CPAN
sub test_enums {
my $elf;
for (qw: executable shared relocatable core :) {
$elf= ELF::Writer->new(type => $_);
is( $elf->type_sym, $_, "enum type=$_ decoded" );
is( $elf->type, $ELF::Writer::type_from_sym{$_}, "enum type=$_ correct value" );
}
$elf= ELF::Writer->new(type => 42);
is( $elf->type, 42, "enum type=42 allowed" );
is( $elf->type_sym, 42, "enum type=42 decoded as self" );
for (qw: 32bit 64bit :) {
$elf= ELF::Writer->new(class => $_);
is( $elf->class_sym, $_, "enum class=$_ decoded" );
is( $elf->class, $ELF::Writer::class_from_sym{$_}, "enum class=$_ correct value" );
}
for (qw: 2LSB 2MSB :) {
$elf= ELF::Writer->new(data => $_);
is( $elf->data_sym, $_, "enum data=$_ decoded" );
is( $elf->data, $ELF::Writer::data_from_sym{$_}, "enum data=$_ correct value" );
}
for (qw: Linux Solaris :) {
$elf= ELF::Writer->new(osabi => $_);
is( $elf->osabi_sym, $_, "enum osabi=$_ decoded" );
is( $elf->osabi, $ELF::Writer::osabi_from_sym{$_}, "enum osabi=$_ correct value" );
}
for (qw: x86-64 :) {
$elf= ELF::Writer->new(machine => $_);
is( $elf->machine_sym, $_, "enum machine=$_ decoded" );
is( $elf->machine, $ELF::Writer::machine_from_sym{$_}, "enum machine=$_ correct value" );
}
for (qw: note :) {
my $seg= ELF::Writer::Segment->new(type => $_);
is( $seg->type_sym, $_, "enum segment.type=$_ decoded" );
is( $seg->type, $ELF::Writer::Segment::type_from_sym{$_}, "enum segment.type=$_ correct value" );
}
};
subtest simple_x86_64_elf => \&test_return_42;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ELab/Client.pm view on Meta::CPAN
file => [ $args{file} ]
},
Content_Type => 'form-data',
Authorization => $self->token(),
);
return decode_json $self->getUseragent()->request($request)->decoded_content();
}
sub upload_to_item {
lib/ELab/Client.pm view on Meta::CPAN
file => [ $args{file} ]
},
Content_Type => 'form-data',
Authorization => $self->token(),
);
return decode_json $self->getUseragent()->request($request)->decoded_content();
}
sub create_event {
view all matches for this distribution
view release on metacpan or search on metacpan
script/ecs_token view on Meta::CPAN
redirect_uri => $redirect_uri,
grant_type => 'authorization_code',
]);
die "Error - Access token request failed: " . $response->status_line . $/ .
$response->decoded_content . $/
unless $response->is_success;
print $OUT $response->decoded_content . $/;
# parse JSON response content
my $parsed_content = decode_json($response->decoded_content);
die "Error - Unexpected response content: " . ref($parsed_content) . $/
unless ref($parsed_content) eq 'HASH';
die "Error - Refresh token not received$/"
script/ecs_token view on Meta::CPAN
die "Error - Access token not received$/"
unless exists $parsed_content->{access_token};
if(not $nocache) {
store_cached_token($response->decoded_content, $token_request_timestamp);
}
}
if($command eq 'credentials') {
# using client credentials flow ... (with client secret, not cert-based JWT)
script/ecs_token view on Meta::CPAN
scope => $scope,
grant_type => 'client_credentials',
]);
die "Error - Access token request failed: " . $response->status_line . $/ .
$response->decoded_content . $/
unless $response->is_success;
# parse JSON response content
my $parsed_content = decode_json($response->decoded_content);
die "Error - Unexpected response content: " . ref($parsed_content) . $/
unless ref($parsed_content) eq 'HASH';
die "Error - Access token not received$/"
unless exists $parsed_content->{access_token};
if(not $nocache) {
store_cached_token($response->decoded_content, $token_request_timestamp);
}
# print access token
print $parsed_content->{access_token}, $/;
}
script/ecs_token view on Meta::CPAN
refresh_token => $refresh_token,
grant_type => 'refresh_token',
]);
die "Error - Access token request failed: " . $response->status_line . $/ .
$response->decoded_content . $/
unless $response->is_success;
# parse JSON response content
my $parsed_content = decode_json($response->decoded_content);
die "Error - Unexpected response content: " . ref($parsed_content) . $/
unless ref($parsed_content) eq 'HASH';
# if indicated, store new refresh token
script/ecs_token view on Meta::CPAN
die "Error - Access token not received$/"
unless exists $parsed_content->{access_token};
if(not $nocache) {
store_cached_token($response->decoded_content, $token_request_timestamp);
}
# print access token
print $parsed_content->{access_token}, $/;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EPFL/Net/ipv6Test.pm view on Meta::CPAN
my $ua = p_createUserAgent();
my $url = p_buildUrl( $api, $domain, $withScheme );
my $response = p_getUrl( $ua, $url );
if ( $response->is_success ) {
my $struct = from_json( $response->decoded_content );
return $struct;
}
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EPFL/Sciper/List.pm view on Meta::CPAN
my $ua = p_createUserAgent();
foreach my $letter (@alphabet) {
my $response = p_getUrl( $ua, p_buildUrl($letter) );
if ( $response->is_success ) {
my $struct = from_json( $response->decoded_content );
push @listPersons, @{ $struct->{result} };
}
}
my %hash = ();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ETL/Yertl/Adapter/graphite.pm view on Meta::CPAN
$url->query_form( %form );
#; say "Fetching $url";
my $res = $self->http_client->GET( $url )->get;
#; say $res->decoded_content;
if ( $res->is_error ) {
die sprintf "Error fetching metric '%s': " . $res->decoded_content . "\n", $metric;
}
my $result = decode_json( $res->decoded_content );
my @points;
for my $series ( @{ $result } ) {
for my $point ( @{ $series->{datapoints} } ) {
push @points, {
metric => $series->{target},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EV/ClickHouse.pm view on Meta::CPAN
are returned as typed Perl scalars by default. C<Date> and C<DateTime>
columns return integer values (days since epoch and Unix timestamps);
enable C<decode_datetime> for formatted strings. C<Enum> columns return
numeric codes; enable C<decode_enum> for string labels. C<Decimal>
columns return unscaled integers; enable C<decode_decimal> for scaled
floats. C<SimpleAggregateFunction> columns are transparently decoded as
their inner type. C<Nested> columns are decoded as arrays of tuples.
C<LowCardinality> columns work across multi-block results with shared
dictionaries.
=head2 insert
view all matches for this distribution
view release on metacpan or search on metacpan
src/EV__Kafka.xs view on Meta::CPAN
/* ================================================================
* RecordBatch decoder (for Fetch responses)
* ================================================================ */
/* Decode records from a RecordBatch, push them as hashrefs onto records_av.
* Returns number of records decoded, or -1 on error. */
static int kf_decode_record_batch(pTHX_ const char *data, size_t len,
AV *records_av, int64_t *out_base_offset)
{
const char *p = data;
const char *end = data + len;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EV/Nats/JetStream.pm view on Meta::CPAN
require JSON::PP;
my $payload = defined $data ? JSON::PP::encode_json($data) : '';
$self->_api($subj, $payload, sub {
my ($resp, $err) = @_;
return $cb->(undef, $err) if $err;
my $decoded = eval { JSON::PP::decode_json($resp) };
if ($@) {
return $cb->(undef, "JSON decode error: $@");
}
if ($decoded->{error}) {
return $cb->(undef, "$decoded->{error}{description} (code $decoded->{error}{code})");
}
$cb->($decoded, undef);
});
}
# Stream management
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EV/Redis.pm view on Meta::CPAN
This callback can be set by C<< $obj->on_disconnect($cb) >> method any time.
=item * on_push => $cb->($reply)
RESP3 push callback for server-initiated out-of-band messages (Redis 6.0+).
Called with the decoded push message (an array reference). This enables
client-side caching invalidation and other server-push features.
This callback can be set by C<< $obj->on_push($cb) >> method any time.
=item * connect_timeout => $num_of_milliseconds
lib/EV/Redis.pm view on Meta::CPAN
returns undef.
=head2 on_push([$cb->($reply)])
Set RESP3 push callback for server-initiated messages (Redis 6.0+).
The callback receives the decoded push message as an array reference.
With a CODE reference argument, replaces the handler and returns the new
handler. With C<undef> or without arguments, clears the handler and
returns undef. When changed while connected, takes effect immediately.
$redis->on_push(sub {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EZID.pm view on Meta::CPAN
my %metadata;
my $ua = LWP::UserAgent->new;
my $r = $ua->get("http://ezid.cdlib.org/id/$identifier");
if ($r->is_success) {
$response = { _parse($r->decoded_content) };
} else {
$self->{_error_msg} = $r->decoded_content;
}
return $response;
}
lib/EZID.pm view on Meta::CPAN
'Content-Type' => "text/plain; charset=UTF-8",
'Content' => $content);
my $response;
if ($r->is_success) {
$response = { _parse($r->decoded_content) };
} else {
$self->{_error_msg} = $r->decoded_content;
}
return $response;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Egg/Model/Auth/Crypt/CBC.pm view on Meta::CPAN
=head1 METHODS
=head2 password_check ([CRYPT_PASSWORD], [INPUT_PAWWORD])
CRYPT_PASSWORD is decoded and whether it agrees is confirmed with INPUT_PAWWORD.
=head2 create_password ([PLAIN_PASSWORD])
PLAIN_PASSWORD is encrypted.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Eixo/Rest/Request.pm view on Meta::CPAN
sub send {die ref($_[0]) . "::send: MUST BE DEFINED"}
sub unmarshall{
my ($self, $response) = @_;
my $content = $response->decoded_content(
default_charset=> 'UTF-8'
);
# nowadays (HTTP::Message v6.11)
# decoded_content isn't decoding utf8 charset
# if content_type is application/json
if($response->content_type eq 'application/json'){
use Encode;
$content = Encode::decode('UTF-8', $content);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Elastic/Model/Types.pm view on Meta::CPAN
has 'binary_field' => (
is => 'ro',
isa => Binary
);
Inherits from the C<Defined> type. Is automatically Base64 encoded/decoded.
=head2 GeoPoint
use Elastic::Model::Types qw(GeoPoint);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ElasticEmail.pm view on Meta::CPAN
push(@{$allTheData[0]}, ($fieldName, [$file, $localFileName]));
$num++;
}
$response = $ua->post($fullURL, Content_Type => 'multipart/form-data', Content => @allTheData);
}
my $content = $response->decoded_content();
return $content;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ElasticSearchX/Model/Generator.pm view on Meta::CPAN
returns the content of the URL at C<mapping_url>
=head2 _build__mapping_data
returns the decoded data from C<JSON> stored in C<_mapping_content>
=head1 AUTHOR
Kent Fredric <kentfredric@gmail.com>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Elastijk.pm view on Meta::CPAN
=head2 Elastijk::request( $args :HashRef ) : ($status :Int, $response :HashRef)
Making a request to the Elasticsearch server specified in C<$args>. It returns 2
values. C<$status> is the HTTP status code of the response, and the C<$response>
decoded as HashRef. Elasticsearch API always respond a single HashRef as JSON
text, this might or might not be changed in the future, if it is changed then
this function will be adjusted accordingly.
The C<$args> is a HashRef takes contains the following key-value pairs:
lib/Elastijk.pm view on Meta::CPAN
=head2 Elastijk::request_raw( $args :HashRef ) : ($status :Int, $response :Str)
Making a request to the Elasticsearch server specified in C<$args>. The main
difference between this function and C<Elastijk::request> is that
C<$args->{body}> s expected to be a String scalar, rather then a HashRef. And
the $response is not decoded from JSON. This function can be used if users wish
to use their own JSON parser to parse response, or if they wish to delay the
parsing to be done latter in some bulk-processing pipeline.
=head1 OBJECT
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/Abstract.pm view on Meta::CPAN
=head2 as_string
my $string = $email->as_string;
This returns the whole email as a decoded string.
=head2 cast
my $mime_entity = $email->cast('MIME::Entity');
lib/Email/Abstract.pm view on Meta::CPAN
#pod
#pod =head2 as_string
#pod
#pod my $string = $email->as_string;
#pod
#pod This returns the whole email as a decoded string.
#pod
#pod =head2 cast
#pod
#pod my $mime_entity = $email->cast('MIME::Entity');
#pod
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
Both LF-only and CRLF line endings are accepted and handled transparently.
A scalar reference is accepted as an alternative to a plain scalar. The
referent is dereferenced internally; the original variable is not modified.
The following body encodings are decoded automatically:
=over 8
=item * C<quoted-printable> (Content-Transfer-Encoding: quoted-printable)
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
=item * C<7bit> / C<8bit> / C<binary> (passed through as-is)
=back
Multipart messages (C<multipart/alternative>, C<multipart/mixed>, etc.)
are split on their boundary and each text part decoded according to its
own Content-Transfer-Encoding. Non-text parts (attachments, inline images)
are silently skipped.
=back
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
normalised to lower-case. When duplicate headers are present, all copies
are retained; accessor methods return the first occurrence.
=item * Body decoding
The message body is decoded according to its Content-Transfer-Encoding and
stored as plain text (C<_body_plain>) and/or HTML (C<_body_html>).
Multipart messages have each qualifying part appended in order.
=item * Sending software extraction
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
HTML part and not in the plain-text part is still reported.
=item *
Decoding errors in base64 or quoted-printable payloads are silenced; the
partially-decoded or raw bytes are used in place of correct output. This
prevents malformed spam from causing exceptions during analysis.
=back
=head3 API Specification
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
hostname. All subsequent calls return the cached list. The cache is
invalidated by C<parse_email()>.
=head3 Algorithm: URL extraction
URLs are extracted from the concatenation of the decoded plain-text body
and the decoded HTML body, in that order. The two extraction passes are:
=over 4
=item 1. Structural HTML parsing (if C<HTML::LinkExtor> is installed)
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
may be held accountable under CAN-SPAM and similar laws.
=item 5. Body (plain-text and HTML)
C<mailto:> links and bare C<user@domain> email addresses are extracted from
the combined decoded body. C<mailto:> links are recognised even when the
C<@> sign is HTML-entity-encoded (C<=40> or C<=3D@>) from quoted-printable
transfer.
=back
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
The header name, lower-cased. One of the six values listed in the
Algorithm section below.
=item C<value> (string)
The header value exactly as it appeared in the message (not decoded or
transformed in any way).
=item C<note> (string)
A fixed, human-readable annotation describing what this header represents
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
}
# ---- Header identity checks ----
# From: display name spoofing another domain
my $from_raw = $self->_header_value('from') // '';
my $from_decoded = $self->_decode_mime_words($from_raw);
if ($from_decoded =~ /^"?([^"<]+?)"?\s*<([^>]+)>/) {
my ($display, $addr) = ($1, $2);
# Extract domains from display name
while ($display =~ /\b([\w-]+\.(?:com|net|org|io|co|uk|au|gov|edu))\b/gi) {
my $disp_domain = lc $1;
my ($addr_domain) = $addr =~ /\@([\w.-]+)/;
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
# Subject encoded to hide content from filters
my $subj_raw = $self->_header_value('subject') // '';
if ($subj_raw =~ /=\?[^?]+\?[BQ]\?/i) {
$flag->('LOW', 'encoded_subject',
"Subject line is MIME-encoded: '$subj_raw' (decoded: '" .
$self->_decode_mime_words($subj_raw) . "')");
}
# ---- URL checks ----
my (%shortener_seen, %url_host_seen);
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
A row of 72 equals signs, the module name and version number, and a
closing row of 72 equals signs.
=item 2. Envelope summary
Up to six header fields, each decoded from MIME encoded-words where
applicable. If a field was encoded, the decoded form is shown first
followed by the raw encoded original in brackets:
From : PayPal Security <phish@evil.example>
Reply-to : Replies <harvest@collector.example>
Return-path : <phish@evil.example>
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
are cached.
=item *
MIME encoded-words in the C<From:>, C<Subject:>, and other displayed
headers are decoded for readability. When a header was encoded, both the
decoded form and the raw encoded original are shown, so the report is
useful both for human reading and for log parsing.
=item *
URL hosts in section 7 are grouped by hostname and shown in first-seen
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
# ---- envelope summary ----
for my $f (qw(from reply-to return-path subject date message-id)) {
my $v = $self->_header_value($f);
next unless defined $v;
my $decoded = $self->_decode_mime_words($v);
my $label = ucfirst($f);
push @out, sprintf(" %-14s : %s", $label,
$decoded ne $v ? "$decoded [encoded: $v]" : $v);
}
push @out, '';
# ---- risk assessment ----
my $risk = $self->risk_assessment();
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
# hashrefs, one per parsed header, in message order.
# Folded (multi-line) values are unfolded before
# parsing (RFC 2822 s2.2.3). Header names are
# normalised to lower-case.
# $self->{_received} set to an arrayref of raw Received: header values
# (not decoded), in message order (most-recent first).
# $self->{_body_plain} set to the decoded plain-text body. Appended to
# (not replaced) for each text/* part in multipart
# messages.
# $self->{_body_html} set to the decoded HTML body. Appended to for
# each text/html part in multipart messages.
# $self->{_sending_sw} populated with { header, value, note } hashrefs
# for any of the six recognised software-fingerprint
# headers that are present, in alphabetical key order.
# $self->{_rcvd_tracking} populated with { received, ip, for, id } hashrefs,
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
if ($ct =~ /multipart/i) {
my ($boundary) = $ct =~ /boundary="?([^";]+)"?/i;
$self->_decode_multipart($body_raw, $boundary) if $boundary;
} else {
my $decoded = $self->_decode_body($body_raw, $cte);
if ($ct =~ /html/i) { $self->{_body_html} = $decoded }
else { $self->{_body_plain} = $decoded }
}
$self->_debug(sprintf "Parsed %d headers, %d Received lines",
scalar @headers, scalar @{ $self->{_received} });
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
}
next; # do not fall through to the text handlers below
}
# Decode the part body according to its transfer encoding
my $decoded = $self->_decode_body($pbody, $pcte);
# Accumulate plain-text and HTML body content separately.
# Both are used by embedded_urls() and mailto_domains().
if ($pct =~ /text\/html/i) { $self->{_body_html} .= $decoded }
elsif ($pct =~ /text/i || !$pct) { $self->{_body_plain} .= $decoded }
}
}
sub _decode_body {
my ($self, $body, $cte) = @_;
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
return {} unless $HAS_LWP;
my $ua = LWP::UserAgent->new(timeout => $self->{timeout},
agent => "Email-Abuse-Investigator/$VERSION");
my $res = eval { $ua->get("https://rdap.arin.net/registry/ip/$ip") };
return {} unless $res && $res->is_success;
my $j = $res->decoded_content;
my %info;
$info{org} = $1 if $j =~ /"name"\s*:\s*"([^"]+)"/;
$info{handle} = $1 if $j =~ /"handle"\s*:\s*"([^"]+)"/;
if ($j =~ /"abuse".*?"email"\s*:\s*"([^"]+)"/s) {
$info{abuse} = $1;
view all matches for this distribution
view release on metacpan or search on metacpan
# ok( $utf_8 !~ $Email::Address::addr_spec, "...it !~ addr_spec");
}
{
my (@addr) = Email::Address->parse($text);
is(@addr, 0, "unicode (decoded) address: not ok");
# ok( $text =~ $Email::Address::addr_spec, "...it !~ addr_spec");
}
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/Barcode/Decode.pm view on Meta::CPAN
my $ebd = Email::Barcode::Decode->new(email => $msg);
my @symbols = $ebd->get_symbols;
foreach my $symbol (@symbols) {
print(
'decoded ' . $symbol->{type} .
' symbol "' . $symbol->{data} .'"'.
' file "' . $symbol->{filename} .'"'.
"\n"
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/UTF-8_html.t view on Meta::CPAN
binmode $builder->failure_output, ":encoding(UTF-8)";
binmode $builder->todo_output, ":encoding(UTF-8)";
my $response = LWP::UserAgent->new->get("file://$Bin/data/UTF-8.html");
my $body = $response->decoded_content;
my $from = generate_address('Föö', 'test@foo.example');
my $to = generate_address('Bäz', 'test@baz.example');
my $subject = encode_mimeword(encode_utf8('Sübject'), 'Q', 'UTF-8');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/MIME/Encodings.pm view on Meta::CPAN
#pod =head1 SYNOPSIS
#pod
#pod use Email::MIME::Encodings;
#pod my $encoded = Email::MIME::Encodings::encode(base64 => $body);
#pod my $decoded = Email::MIME::Encodings::decode(base64 => $encoded);
#pod
#pod If a third argument is given, it is the encoding to which to fall back. If no
#pod valid codec can be found (considering both the first and third arguments) then
#pod an exception is raised.
#pod
lib/Email/MIME/Encodings.pm view on Meta::CPAN
=head1 SYNOPSIS
use Email::MIME::Encodings;
my $encoded = Email::MIME::Encodings::encode(base64 => $body);
my $decoded = Email::MIME::Encodings::decode(base64 => $encoded);
If a third argument is given, it is the encoding to which to fall back. If no
valid codec can be found (considering both the first and third arguments) then
an exception is raised.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/MIME/Kit/Assembler/Markdown.pm view on Meta::CPAN
}
sub assemble {
my ($self, $stash) = @_;
my $markdown = ${ $self->kit->get_decoded_kit_entry( $self->path ) };
my $plaintext = $markdown;
if ($self->renderer) {
{
lib/Email/MIME/Kit/Assembler/Markdown.pm view on Meta::CPAN
for my $type (keys %content) {
my $type_wrapper = "$type\_wrapper";
if (my $wrapper_path = $self->$type_wrapper) {
my $wrapper = ${ $self->kit->get_decoded_kit_entry($wrapper_path) };
if ($self->render_wrapper) {
local $stash->{wrapped_content} = $content{$type};
local $stash->{part_type} = $type;
my $output_ref = $self->renderer->render(\$wrapper, $stash);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/MIME/Kit.pm view on Meta::CPAN
#pod render, and so on. This, further, means that strings passed to the C<assemble>
#pod method for use in rendering should also be text strings.
#pod
#pod In older versions of Email::MIME::Kit, files read from disk were read in raw
#pod mode and then handled as octet strings. Meanwhile, the manifest's contents
#pod (and, thus, any templates stored as strings in the manifest) were decoded into
#pod text strings. This could lead to serious problems. For example: the
#pod F<manifest.json> file might contain:
#pod
#pod "header": [
#pod { "Subject": "Message for [% customer_name %]" },
lib/Email/MIME/Kit.pm view on Meta::CPAN
has manifest => (reader => 'manifest', writer => '_set_manifest');
my @auto_attrs = (
[ manifest_reader => ManifestReader => JSON => [ 'read_manifest' ] ],
[ kit_reader => KitReader => Dir => [ 'get_kit_entry',
'get_decoded_kit_entry' ] ],
);
for my $tuple (@auto_attrs) {
my ($attr, $role, $default, $handles) = @$tuple;
lib/Email/MIME/Kit.pm view on Meta::CPAN
render, and so on. This, further, means that strings passed to the C<assemble>
method for use in rendering should also be text strings.
In older versions of Email::MIME::Kit, files read from disk were read in raw
mode and then handled as octet strings. Meanwhile, the manifest's contents
(and, thus, any templates stored as strings in the manifest) were decoded into
text strings. This could lead to serious problems. For example: the
F<manifest.json> file might contain:
"header": [
{ "Subject": "Message for [% customer_name %]" },
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_parse.t view on Meta::CPAN
my $mail = Email::MIME::MobileJP::Parser->new($src->as_string);
subtest 'subject' => sub {
is $mail->subject(), 'ã³ã³ããã¯';
ok Encode::is_utf8($mail->subject), 'decoded';
};
subtest 'carrier' => sub {
isa_ok $mail->carrier, 'Email::Address::JP::Mobile::DoCoMo';
is $mail->carrier->name, 'DoCoMo';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/MIME.pm view on Meta::CPAN
#pod
#pod use Email::MIME;
#pod my $parsed = Email::MIME->new($message);
#pod
#pod my @parts = $parsed->parts; # These will be Email::MIME objects, too.
#pod my $decoded = $parsed->body;
#pod my $non_decoded = $parsed->body_raw;
#pod
#pod my $content_type = $parsed->content_type;
#pod
#pod ...or...
#pod
lib/Email/MIME.pm view on Meta::CPAN
#pod =head1 DESCRIPTION
#pod
#pod This is an extension of the L<Email::Simple> module, to handle MIME
#pod encoded messages. It takes a message as a string, splits it up into its
#pod constituent parts, and allows you access to various parts of the
#pod message. Headers are decoded from MIME encoding.
#pod
#pod =head1 METHODS
#pod
#pod Please see L<Email::Simple> for the base set of methods. It won't take
#pod very long. Added to that, you have:
lib/Email/MIME.pm view on Meta::CPAN
use Email::MIME;
my $parsed = Email::MIME->new($message);
my @parts = $parsed->parts; # These will be Email::MIME objects, too.
my $decoded = $parsed->body;
my $non_decoded = $parsed->body_raw;
my $content_type = $parsed->content_type;
...or...
lib/Email/MIME.pm view on Meta::CPAN
=head1 DESCRIPTION
This is an extension of the L<Email::Simple> module, to handle MIME
encoded messages. It takes a message as a string, splits it up into its
constituent parts, and allows you access to various parts of the
message. Headers are decoded from MIME encoding.
=head1 PERL VERSION
This library should run on perls released even a long time ago. It should
work on any version of perl released in the last five years.
lib/Email/MIME.pm view on Meta::CPAN
=head2 header_str_pairs
my @pairs = $email->header_str_pairs;
This method behaves like C<header_raw_pairs>, returning a list of field
name/value pairs, but the values have been decoded to character strings, when
possible.
=head2 header_as_obj
my $first_obj = $email->header_as_obj($field);
lib/Email/MIME.pm view on Meta::CPAN
#pod =method header_str_pairs
#pod
#pod my @pairs = $email->header_str_pairs;
#pod
#pod This method behaves like C<header_raw_pairs>, returning a list of field
#pod name/value pairs, but the values have been decoded to character strings, when
#pod possible.
#pod
#pod =method header_as_obj
#pod
#pod my $first_obj = $email->header_as_obj($field);
view all matches for this distribution