view release on metacpan or search on metacpan
lib/Crypt/X509/CRL.pm view on Meta::CPAN
=head1 SYNOPSIS
use Crypt::X509::CRL;
$decoded = Crypt::X509::CRL->new( crl => $crl );
$subject_email = $decoded->subject_email;
print "do not use after: ".gmtime($decoded->not_after)." GMT\n";
=head1 REQUIRES
Convert::ASN1
lib/Crypt/X509/CRL.pm view on Meta::CPAN
=head2 new ( OPTIONS )
Creates and returns a parsed X.509 CRL hash, containing the parsed
contents. The data is organised as specified in RFC 2459.
By default only the first ASN.1 Layer is decoded. Nested decoding
is done automagically through the data access methods.
=over 4
=item crl =E<gt> $crl
lib/Crypt/X509/CRL.pm view on Meta::CPAN
=head3 Example:
use Crypt::X509::CRL;
use Data::Dumper;
$decoded = Crypt::X509::CRL->new( crl => $crl );
print Dumper $decoded;
=cut back
=head1 METHODS
lib/Crypt/X509/CRL.pm view on Meta::CPAN
Returns the last error from parsing, C<undef> when no error occured.
This error is updated on deeper parsing with the data access methods.
=head3 Example:
$decoded= Crypt::X509::CRL->new(crl => $crl);
if ( $decoded->error ) {
warn "Error on parsing Certificate Revocation List: ", $decoded->error;
}
=cut back
=head1 DATA ACCESS METHODS
lib/Crypt/X509/CRL.pm view on Meta::CPAN
Returns either the utcTime or generalTime of the certificate revocation list's date
of publication. Returns undef if not defined.
=head3 Example:
$decoded = Crypt::X509::CRL->new(crl => $crl);
print "CRL was published at ", gmtime( $decoded->this_update ), " GMT\n";
=cut back
=head2 next_update
Returns either the utcTime or generalTime of the certificate revocation list's
date of expiration. Returns undef if not defined.
=head3 Example:
$decoded = Crypt::X509::CRL->new(crl => $crl);
if ( $decoded->next_update < time() ) {
warn "CRL has expired!";
}
=cut back
lib/Crypt/X509/CRL.pm view on Meta::CPAN
Returns the certificate's signature algorithm as an OID string.
=head3 Example:
$decoded = Crypt::X509::CRL->new(crl => $crl);
print "CRL signature is encrypted with:", $decoded->signature_algorithm, "\n";
Example Output: CRL signature is encrypted with: 1.2.840.113549.1.1.5
=cut back
lib/Crypt/X509/CRL.pm view on Meta::CPAN
Returns the signature encryption algorithm (e.g. 'RSA') as a string.
=head3 Example:
$decoded = Crypt::X509::CRL->new(crl => $crl);
print "CRL signature is encrypted with:", $decoded->SigEncAlg, "\n";
Example Output: CRL signature is encrypted with: RSA
=cut back
lib/Crypt/X509/CRL.pm view on Meta::CPAN
Returns the signature hashing algorithm (e.g. 'SHA1') as a string.
=head3 Example:
$decoded = Crypt::X509::CRL->new(crl => $crl);
print "CRL signature is hashed with:", $decoded->SigHashAlg, "\n";
Example Output: CRL signature is encrypted with: SHA1
=cut back
lib/Crypt/X509/CRL.pm view on Meta::CPAN
issuer (= the DN of the CA). Attribute names for the most common Attributes
are translated from the OID-Numbers, unknown numbers are output verbatim.
=head3 Example:
$decoded = Crypt::X509::CRL->new( $crl );
print "CRL was issued by: ", join( ', ' , @{ $decoded->Issuer } ), "\n";
=cut back
=head2 issuer_cn
lib/Crypt/X509/CRL.pm view on Meta::CPAN
Returns the authority key identifier as a bit string.
=head3 Example:
$decoded = Crypt::X509::CRL->new( $crl );
my $s = unpack("H*" , $decoded->key_identifier);
print "The Authority Key Identifier in HEX is: $s\n";
Example output:
The Authority Key Identifier in HEX is: 86595f93caf32da620a4f9595a4a935370e792c9
lib/Crypt/X509/CRL.pm view on Meta::CPAN
OID-Numbers, unknown numbers are output verbatim. Returns undef if the
extension is not set in the certificate.
=head3 Example:
$decoded = Crypt::X509::CRL->new($cert);
print "Certificate was authorised by:", join( ', ', @{ $decoded->authorityCertIssuer } ), "\n";
=cut back
=head2 authority_serial
lib/Crypt/X509/CRL.pm view on Meta::CPAN
Returns the Issuing Distribution Points as a hash providing for the default values.
=head3 Example:
print "Issuing Distribution Points:\n";
my $IDPs = $decoded->IDPs;
for my $key ( sort keys %{ $IDPs } ) {
print "$key = ";
if ( defined $IDPs->{ $key } ) {
print $IDPs->{ $key }, "\n";
} else {
lib/Crypt/X509/CRL.pm view on Meta::CPAN
keys to the hash are the certificate serial numbers in decimal format.
=head3 Example:
print "Revocation List:\n";
my $rls = $decoded->revocation_list;
my $count_of_rls = keys %{ $rls };
print "Found $count_of_rls revoked certificate(s) on this CRL.\n";
for my $key ( sort keys %{ $rls } ) {
print "Certificate: ", DecimalToHex( $key ), "\n";
for my $extn ( sort keys %{ $rls->{ $key } } ) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/X509.pm view on Meta::CPAN
=head1 SYNOPSIS
use Crypt::X509;
$decoded = Crypt::X509->new( cert => $cert );
$subject_email = $decoded->subject_email;
print "do not use after: ".gmtime($decoded->not_after)." GMT\n";
=head1 REQUIRES
Convert::ASN1
lib/Crypt/X509.pm view on Meta::CPAN
=head2 new ( OPTIONS )
Creates and returns a parsed X.509 certificate hash, containing the parsed
contents. The data is organised as specified in RFC 2459.
By default only the first ASN.1 Layer is decoded. Nested decoding
is done automagically through the data access methods.
=over 4
=item cert =E<gt> $certificate
lib/Crypt/X509.pm view on Meta::CPAN
=back
use Crypt::X509;
use Data::Dumper;
$decoded= Crypt::X509->new(cert => $cert);
print Dumper($decoded);
=cut back
sub new {
my ( $class, %args ) = @_;
lib/Crypt/X509.pm view on Meta::CPAN
Returns the last error from parsing, C<undef> when no error occured.
This error is updated on deeper parsing with the data access methods.
$decoded= Crypt::X509->new(cert => $cert);
if ($decoded->error) {
warn "Error on parsing Certificate:".$decoded->error;
}
=cut back
sub error {
lib/Crypt/X509.pm view on Meta::CPAN
returns the serial number (integer or Math::BigInt Object, that gets automagic
evaluated in scalar context) from the certificate
$decoded= Crypt::X509->new(cert => $cert);
print "Certificate has serial number:".$decoded->serial."\n";
=cut back
sub serial {
my $self = shift;
lib/Crypt/X509.pm view on Meta::CPAN
hold the timesamps as "generalTime"-entries. B<The contents of "generalTime"-entries
are not well defined in the RFC and
are returned by this module unmodified>, if no utcTime-entry is found.
$decoded= Crypt::X509->new(cert => $cert);
if ($decoded->notBefore < time()) {
warn "Certificate: not yet valid!";
}
=cut back
lib/Crypt/X509.pm view on Meta::CPAN
hold the timesamps as "generalTime"-entries. B<The contents of "generalTime"-entries
are not well defined in the RFC and
are returned by this module unmodified>, if no utcTime-entry is found.
$decoded= Crypt::X509->new(cert => $cert);
print "Certificate expires on ".gmtime($decoded->not_after)." GMT\n";
=cut back
sub not_after {
my $self = shift;
lib/Crypt/X509.pm view on Meta::CPAN
=head2 PubKeyAlg
returns the subject public key encryption algorithm (e.g. 'RSA') as string.
$decoded= Crypt::X509->new(cert => $cert);
print "Certificate public key is encrypted with:".$decoded->PubKeyAlg."\n";
Example Output: Certificate public key is encrypted with: RSA
=cut back
lib/Crypt/X509.pm view on Meta::CPAN
=head2 sig_algorithm
Returns the certificate's signature algorithm as OID string
$decoded= Crypt::X509->new(cert => $cert);
print "Certificate signature is encrypted with:".$decoded->sig_algorithm."\n";>
Example Output: Certificate signature is encrypted with: 1.2.840.113549.1.1.5
=cut back
lib/Crypt/X509.pm view on Meta::CPAN
=head2 SigEncAlg
returns the signature encryption algorithm (e.g. 'RSA') as string.
$decoded= Crypt::X509->new(cert => $cert);
print "Certificate signature is encrypted with:".$decoded->SigEncAlg."\n";
Example Output: Certificate signature is encrypted with: RSA
=cut back
lib/Crypt/X509.pm view on Meta::CPAN
=head2 SigHashAlg
returns the signature hashing algorithm (e.g. 'SHA1') as string.
$decoded= Crypt::X509->new(cert => $cert);
print "Certificate signature is hashed with:".$decoded->SigHashAlg."\n";
Example Output: Certificate signature is encrypted with: SHA1
=cut back
lib/Crypt/X509.pm view on Meta::CPAN
returns a pointer to an array of strings containing subject nameparts of the
certificate. Attributenames for the most common Attributes are translated
from the OID-Numbers, unknown numbers are output verbatim.
$decoded= Convert::ASN1::X509->new($cert);
print "DN for this Certificate is:".join(',',@{$decoded->Subject})."\n";
=cut back
sub Subject {
my $self = shift;
lib/Crypt/X509.pm view on Meta::CPAN
returns a pointer to an array of strings building the DN of the certificate
issuer (= the DN of the CA). Attributenames for the most common Attributes
are translated from the OID-Numbers, unknown numbers are output verbatim.
$decoded= Crypt::X509->new($cert);
print "Certificate was issued by:".join(',',@{$decoded->Issuer})."\n";
=cut back
sub Issuer {
my $self = shift;
my ( $i, $type );
lib/Crypt/X509.pm view on Meta::CPAN
for this certificate. C<undef> is returned, when the extension is not set in the
certificate.
If the extension is marked critical, this is also reported.
$decoded= Crypt::X509->new(cert => $cert);
print "Allowed usages for this Certificate are:\n".join("\n",@{$decoded->KeyUsage})."\n";
Example Output:
Allowed usages for this Certificate are:
critical
digitalSignature
lib/Crypt/X509.pm view on Meta::CPAN
C<undef> if the extension is not filled. OIDs of the following ExtKeyUsages are known:
serverAuth, clientAuth, codeSigning, emailProtection, timeStamping, OCSPSigning
If the extension is marked critical, this is also reported.
$decoded= Crypt::X509->new($cert);
print "ExtKeyUsage extension of this Certificates is: ", join(", ", @{$decoded->ExtKeyUsage}), "\n";
Example Output: ExtKeyUsage extension of this Certificates is: critical, serverAuth
=cut back
our %oid2extkeyusage = (
lib/Crypt/X509.pm view on Meta::CPAN
C<undef> if the extension is not filled. Usually this Extension holds the e-Mail
address for person-certificates or DNS-Names for server certificates.
It also pre-pends the field type (ie rfc822Name) to the returned value.
$decoded= Crypt::X509->new($cert);
print "E-Mail or Hostnames in this Certificates is/are:", join(", ", @{$decoded->SubjectAltName}), "\n";
Example Output: E-Mail or Hostnames in this Certificates is/are: rfc822Name=user@server.com
=cut back
lib/Crypt/X509.pm view on Meta::CPAN
=head2 DecodedSubjectAltNames
Returns a pointer to an array of strings containing all the alternative subject name
extensions.
Each such extension is represented as a decoded ASN.1 value, i.e. a pointer to a list
of pointers to objects, each object having a single key with the type of the alternative
name and a value specific to that type.
Example return value:
lib/Crypt/X509.pm view on Meta::CPAN
returns a pointer to an array of strings building the DN of the Authority Cert
Issuer. Attributenames for the most common Attributes
are translated from the OID-Numbers, unknown numbers are output verbatim.
undef if the extension is not set in the certificate.
$decoded= Crypt::X509->new($cert);
print "Certificate was authorised by:".join(',',@{$decoded->authorityCertIssuer})."\n";
=cut back
sub authorityCertIssuer {
my $self = shift;
lib/Crypt/X509.pm view on Meta::CPAN
=head2 EntrustVersionInfo
Returns the EntrustVersion as a string
print "Entrust Version: ", $decoded->EntrustVersion, "\n";
Example Output: Entrust Version: V7.0
=cut back
lib/Crypt/X509.pm view on Meta::CPAN
=head2 SubjectDirectoryAttributes
Returns the SubjectDirectoryAttributes as an array of key = value pairs, to include a data type
print "Subject Directory Attributes: ", join( ', ' , @{ $decoded->SubjectDirectoryAttributes } ), "\n";
Example Output: Subject Directory Attributes: 1.2.840.113533.7.68.29 = 7 (integer)
=cut back
lib/Crypt/X509.pm view on Meta::CPAN
=head2 SubjectInfoAccess
Returns the SubjectInfoAccess as an array of hashes with key=value pairs.
print "Subject Info Access: ";
if ( defined $decoded->SubjectInfoAccess ) {
my %SIA = $decoded->SubjectInfoAccess;
for my $key ( keys %SIA ) {
print "\n\t$key: \n\t";
print join( "\n\t" , @{ $SIA{$key} } ), "\n";
}
} else { print "\n" }
lib/Crypt/X509.pm view on Meta::CPAN
Returns the creation timestamp of the corresponding OpenPGP key.
(see http://www.imc.org/ietf-openpgp/mail-archive/msg05320.html)
print "PGPExtension: ";
if ( defined $decoded->PGPExtension ) {
my $creationtime = $decoded->PGPExtension;
printf "\n\tcorresponding OpenPGP Creation Time: ", $creationtime, "\n";
}
Example Output:
PGPExtension:
view all matches for this distribution
view release on metacpan or search on metacpan
inc/CryptX_PK_DSA.xs.inc view on Meta::CPAN
}
else {
rv = pem_decode_pkcs(data, (unsigned long)data_len, &key_from_pem, NULL);
}
if (rv != CRYPT_OK) croak("FATAL: pem_decode_pkcs failed: %s", error_to_string(rv));
if (key_from_pem.id != LTC_PKA_DSA) croak("FATAL: pem_decode_pkcs decoded non-DSA key");
self->key = key_from_pem.u.dsa;
XPUSHs(ST(0)); /* return self */
}
void
inc/CryptX_PK_DSA.xs.inc view on Meta::CPAN
}
else {
rv = pem_decode_openssh(data, (unsigned long)data_len, &key_from_pem, NULL);
}
if (rv != CRYPT_OK) croak("FATAL: pem_decode_openssh failed: %s", error_to_string(rv));
if (key_from_pem.id != LTC_PKA_DSA) croak("FATAL: pem_decode_openssh decoded non-DSA key");
self->key = key_from_pem.u.dsa;
XPUSHs(ST(0)); /* return self */
}
void
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypto/NanoRPC.pm view on Meta::CPAN
sub __do_rpc {
my ($self,$json) = @_;
$self->{request}->content($json);
my $response = $self->{ua}->request($self->{request});
if ($response->is_success) {
return decode_json($response->decoded_content);
}
return { error => "RPC call failed" };
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CryptoTron/BroadcastTransaction.pm view on Meta::CPAN
sub encode {
# Assign the argument to the local variable.
my $content = $_[0];
# Decode the content from the response.
my $json_decode = $JSON->decode($content);
# Encode the decoded content from the response.
my $json_encode = $JSON->encode($json_decode);
# Return the encoded content.
return $json_encode;
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CryptoTron/ClaimReward.pm view on Meta::CPAN
my $content = $_[0];
# Set up the options for the Perl module JSON::PP.
my $json = 'JSON::PP'->new->pretty;
# Decode the content from the response.
my $json_decode = $json->decode($content);
# Encode the decoded content from the response.
my $json_encode = $json->encode($json_decode);
# Return the encoded content.
return $json_encode;
};
lib/CryptoTron/ClaimReward.pm view on Meta::CPAN
# Assign the subroutine argument to the local variable.
my $json_data = $_[0];
# Set up the options for the Perl module JSON::PP.
my $json = 'JSON::PP'->new->pretty;
# Decode the JSON data.
my $decoded = $json->decode($json_data);
# Extract the txID from the JSON data.
my $txID = $decoded->{'txID'};
# Return the extracted txID.
return $txID;
};
# ---------------------------------------------------------------------------- #
lib/CryptoTron/ClaimReward.pm view on Meta::CPAN
# Assign the subroutine argument to the local variable.
my $json_data = $_[0];
# Set up the options for the Perl module JSON::PP.
my $json = 'JSON::PP'->new->pretty;
# Decode the JSON data.
my $decoded = $json->decode($json_data);
# Extract the raw_data from the JSON data.
my $raw_data_hex = $decoded->{'raw_data_hex'};
# Return the extracted raw data.
return $raw_data_hex;
};
# ---------------------------------------------------------------------------- #
lib/CryptoTron/ClaimReward.pm view on Meta::CPAN
# Assign the subroutine argument to the local variable.
my $json_data = $_[0];
# Set up the options for the Perl module JSON::PP.
my $json = 'JSON::PP'->new->pretty;
# Decode the JSON data.
my $decoded = $json->decode($json_data);
# Extract the raw_data from the JSON data.
my $raw_data = $decoded->{'raw_data'};
#$raw_data = to_json($raw_data);
$raw_data = encode_json($raw_data);
# Return the extracted raw data.
return $raw_data;
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cucumber/Messages.pm view on Meta::CPAN
=head4 body
The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment
is simply the string. If it's `BASE64`, the string should be Base64 decoded to
obtain the attachment.
=cut
has body =>
(is => 'ro',
lib/Cucumber/Messages.pm view on Meta::CPAN
);
=head4 content_encoding
Whether to interpret `body` "as-is" (IDENTITY) or if it needs to be Base64-decoded (BASE64).
Content encoding is *not* determined by the media type, but rather by the type
of the object being attached:
- string: IDENTITY
view all matches for this distribution
view release on metacpan or search on metacpan
# Check utf8 and non-utf8 results
sub check_dirs {
my ($test, $utf8, $non_utf8) = @_;
my $utf8_encoded = encode_utf8($utf8);
my $non_utf8_decoded = decode_utf8($non_utf8, FB_CROAK | LEAVE_SRC);
plan tests => 3;
like $utf8 => qr/\/$unicode_dir$/, "$test found correct dir";
is $utf8_encoded => $non_utf8, "$test encoded utf8 dir matches non-utf8";
is $utf8 => $non_utf8_decoded, "$test utf8 dir matches decoded non-utf8";
}
plan tests => 9;
use Cwd;
view all matches for this distribution
view release on metacpan or search on metacpan
use utf8;
# Export du, dw, de, dn, dustr, dwstr, destr, dnstr functions
use D;
# Reference data that contains decoded strings
my $data = [{name => 'ã'}, {name => 'ã'}];
# Encode all strings in reference data to UTF-8 and dump the reference data to STDERR.
du $data;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DAPNET/API.pm view on Meta::CPAN
my($res) = $ua->request($req);
print('Request status line: '.$res->status_line."\n") if($self->{DEBUG}) ;
if (!$res->is_success) {
return($res->status_line);
};
print('JSON Response: '.$res->decoded_content."\n") if($self->{DEBUG});
$self->{_JSONRESPONSEREF} = $jsonresobj->decode($res->decoded_content);
} else {
while (my $substr = substr($text,0,(76 - $self->{_CALL_LEN}),'')) {
if ($i == 1) {
print("substr begining: $substr \n") if($self->{DEBUG});
$json = $self->_json_individual_call($self->{CALLSIGN}.':'.$substr.'...',$to,$txgroup,$emergency);
lib/DAPNET/API.pm view on Meta::CPAN
my($res) = $ua->request($req);
print('Request status line: '.$res->status_line."\n") if($self->{DEBUG});
if (!$res->is_success) {
return($res->status_line);
};
print('JSON Response: '.$res->decoded_content."\n") if($self->{DEBUG});
$self->{_JSONRESPONSEREF} = $jsonresobj->decode($res->decoded_content);
$i++;
};
};
lib/DAPNET/API.pm view on Meta::CPAN
my($res) = $ua->request($req);
print('Request status line: '.$res->status_line."\n") if($self->{DEBUG});
if (!$res->is_success) {
return($res->status_line);
};
print('JSON Response: '.$res->decoded_content."\n") if($self->{DEBUG});
$self->{_JSONRESPONSEREF} = $jsonresobj->decode($res->decoded_content);
} else {
while (my $substr = substr($text,0,(76 - $self->{_CALL_LEN}),'')) {
if ($i == 1) {
print("substr begining: $substr \n") if($self->{DEBUG});
lib/DAPNET/API.pm view on Meta::CPAN
my($res) = $ua->request($req);
print('Request status line: '.$res->status_line."\n") if($self->{DEBUG});
if (!$res->is_success) {
return($res->status_line);
};
print('JSON Response: '.$res->decoded_content."\n") if($self->{DEBUG});
$self->{_JSONRESPONSEREF} = $jsonresobj->decode($res->decoded_content);
$i++;
};
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DB/CouchDB.pm view on Meta::CPAN
my $req = HTTP::Request->new($method, $uri);
$req->content(Encode::encode('utf8', $content));
my $ua = LWP::UserAgent->new();
my $return = $ua->request($req);
my $response = $return->decoded_content({
default_charset => 'utf8'
});
my $decoded;
eval {
$decoded = $self->json()->decode($response);
};
if ($@) {
return {error => $return->code, reason => $response};
}
return $decoded;
}
package DB::CouchDB::Iter;
sub new {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DB/Object.pm view on Meta::CPAN
If the parameter property I<uri> was provided of if the environment variable C<DB_CON_URI> is set, it will use this connection uri to get the necessary connection parameters values.
An L<URI> could be C<http://localhost:5432?database=somedb> or C<file:/foo/bar?opt={"RaiseError":true}>
Alternatively, if the connection parameter I<conf_file> is provided then its json content will be read and decoded into an hash reference.
The following keys can be used in the json data in the I<conf_file>: C<database>, C<login>, C<passwd>, C<host>, C<port>, C<driver>, C<schema>, C<opt>
The port can be specified in the I<host> parameter by separating it with a semicolon such as C<localhost:5432>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DB2/Admin.pm view on Meta::CPAN
=head2 GetSnapshot
This method performs a database snapshot and returns the collected
snapshot data. It can collect data in one or more monitoring areas,
then returns a hash reference with decoded snapshot results.
This method takes the following named parameters, of which only
C<Subject> is required:
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/SQL/Amazon/Request/Request.pm view on Meta::CPAN
my $resp = $obj->{_lwp}->post($url_roots{$obj->{_locale}}, $url_params);
if ($dbgname && (! -e $dbgname)) {
open(XMLF, ">$dbgname") || die $!;
print XMLF $resp->decoded_content;
close XMLF;
}
$obj->{_errstr} = 'Amazon ECS request failed: Unknown reason.',
return undef
unless $resp;
$obj->{_errstr} = 'Amazon ECS request failed: ' . $resp->status_line,
return undef
unless $resp->is_success;
$xml = XMLin($resp->decoded_content);
}
$obj->{_errstr} = 'Unable to parse Amazon ECS response.',
return undef
unless $xml;
view all matches for this distribution
view release on metacpan or search on metacpan
* fix compiler warnings:
+ use printf formats matching the arguments
+ use 0 instead of NULL where an integer is expected
+ allocate XSQLDA as char array
+ fix conversion of decimal(x,y) to string
* use the decoded milliseconds when formatting times (also fixes a warning)
* do not link with libdl.so on linux
* fix joined lines in reserved words list
* add new keywords for Firebird 2.5 (part of #12)
* Removed restrictions on distribution
* Readme cleanup
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/JDBC.pm view on Meta::CPAN
my ($self, $ber, $arg) = @_;
my ($ber2, $tag, $i, $field);
$self->unpack($ber, \$ber2);
# This value indicates whether or not there's a row to be decoded.
$ber2->decode(INTEGER => \$i);
push @$arg, $i;
if ($i) {
# tag() will return undef when the end of the buffer is reached
view all matches for this distribution
view release on metacpan or search on metacpan
Changes.historic view on Meta::CPAN
(https://github.com/perl5-dbi/DBD-mysql/pull/76)
2016-12-12 Patrick Galbraith, Michiel Beijen, DBI/DBD community (4.041_1)
* Unicode fixes: when using mysql_enable_utf8 or mysql_enable_utf8mb4,
previous versions of DBD::mysql did not properly encode input statements
to UTF-8 and retrieved columns were always UTF-8 decoded regardless of the
column charset.
Fix by Pali Rohár.
Reported and feedback on fix by Marc Lehmann
(https://rt.cpan.org/Public/Bug/Display.html?id=87428)
Also, the UTF-8 flag was not set for decoded data:
(https://rt.cpan.org/Public/Bug/Display.html?id=53130)
* Return INTs with ZEROFILL as strings. Reported by Knarf, fix by Pali Rohár.
(https://rt.cpan.org/Public/Bug/Display.html?id=118977)
2016-11-28 Patrick Galbraith, Michiel Beijen, DBI/DBD community (4.041)
view all matches for this distribution
view release on metacpan or search on metacpan
data was in, in the database. This was inconvenient and arguably a
mistake. Columns like nchar/nvarchar etc were bound as SQL_WCHAR and
returned as Unicode. This release changes the behaviour in a unicode
build of DBD::ODBC to bind all char columns as SQL_WCHAR. This may
inconvenience a few people who expected 8bit chars back, knew the
char set and decoded them (sorry). See odbc_old_unicode to return
to old behaviour.
[ENHANCEMENTS]
* added -w option to Makefile.PL to add "-Wall" to CCFLAGS and
view all matches for this distribution
view release on metacpan or search on metacpan
- OCI_THREADED setting had been accidentally removed, causing potential
crashes when using threads. (RT#92229, Martin J. Evans, reported
by Detlef Lütticke)
- When using fetch*_hashref the values are decoded but
not the keys so if you have unicode column names they were not
returned correctly. (RT#92134, Martin J. Evans, reported by
Marcel Montes)
view all matches for this distribution
view release on metacpan or search on metacpan
#define PTF_LEAF 0x08
/*
** As each page of the file is loaded into memory, an instance of the following
** structure is appended and initialized to zero. This structure stores
** information about the page that is decoded from the raw file page.
**
** The pParent field points back to the parent page. This allows us to
** walk up the BTree from any leaf to the root. Care must be taken to
** unref() the parent page pointer when this page is no longer referenced.
** The pageDestructor() routine handles that chore.
}
/*
** Given the nKey-byte encoding of a record in pKey[], populate the
** UnpackedRecord structure indicated by the fourth argument with the
** contents of the decoded record.
*/
SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
KeyInfo *pKeyInfo, /* Information about the record format */
int nKey, /* Size of the binary record */
const void *pKey, /* The binary record */
BtCursor *pCrsr; /* The BTree cursor */
u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */
int len; /* The length of the serialized data for the column */
int i; /* Loop counter */
Mem *pDest; /* Where to write the extracted value */
Mem sMem; /* For storing the record being decoded */
const u8 *zData; /* Part of the record being decoded */
const u8 *zHdr; /* Next unparsed byte of the header */
const u8 *zEndHdr; /* Pointer to first byte after the header */
u32 offset; /* Offset into the data */
u32 szField; /* Number of bytes in the content of a field */
u32 avail; /* Number of bytes of available data */
** Attempt the transfer optimization on INSERTs of the form
**
** INSERT INTO tab1 SELECT * FROM tab2;
**
** The xfer optimization transfers raw records from tab2 over to tab1.
** Columns are not decoded and reassembled, which greatly improves
** performance. Raw index records are transferred in the same way.
**
** The xfer optimization is only attempted if tab1 and tab2 are compatible.
** There are lots of rules for determining compatibility - see comments
** embedded in the code for details.
/*
** Convert raw bits from the on-disk RTree record into a coordinate value.
** The on-disk format is big-endian and needs to be converted for little-
** endian platforms. The on-disk record stores integer coordinates if
** eInt is true and it stores 32-bit floating point records if eInt is
** false. a[] is the four bytes of the on-disk record to be decoded.
** Store the results in "r".
**
** There are three versions of this macro, one each for little-endian and
** big-endian processors and a third generic implementation. The endian-
** specific implementations are much faster and are preferred if the
** implementation will only be used if this module is compiled as part
** of the amalgamation.
*/
#if defined(SQLITE_BYTEORDER) && SQLITE_BYTEORDER==1234
#define RTREE_DECODE_COORD(eInt, a, r) { \
RtreeCoord c; /* Coordinate decoded */ \
memcpy(&c.u,a,4); \
c.u = ((c.u>>24)&0xff)|((c.u>>8)&0xff00)| \
((c.u&0xff)<<24)|((c.u&0xff00)<<8); \
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
}
#elif defined(SQLITE_BYTEORDER) && SQLITE_BYTEORDER==4321
#define RTREE_DECODE_COORD(eInt, a, r) { \
RtreeCoord c; /* Coordinate decoded */ \
memcpy(&c.u,a,4); \
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
}
#else
#define RTREE_DECODE_COORD(eInt, a, r) { \
RtreeCoord c; /* Coordinate decoded */ \
c.u = ((u32)a[0]<<24) + ((u32)a[1]<<16) \
+((u32)a[2]<<8) + a[3]; \
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
}
#endif
view all matches for this distribution
view release on metacpan or search on metacpan
** the last integer which is specified by three characters. The meaning
** of a four-character format specifiers ABCD is:
**
** A: number of digits to convert. Always "2" or "4".
** B: minimum value. Always "0" or "1".
** C: maximum value, decoded as:
** a: 12
** b: 14
** c: 24
** d: 31
** e: 59
}
/*
** Given the nKey-byte encoding of a record in pKey[], populate the
** UnpackedRecord structure indicated by the fourth argument with the
** contents of the decoded record.
*/
SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
KeyInfo *pKeyInfo, /* Information about the record format */
int nKey, /* Size of the binary record */
const void *pKey, /* The binary record */
BtCursor *pCrsr; /* The BTree cursor */
u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */
int len; /* The length of the serialized data for the column */
int i; /* Loop counter */
Mem *pDest; /* Where to write the extracted value */
Mem sMem; /* For storing the record being decoded */
const u8 *zData; /* Part of the record being decoded */
const u8 *zHdr; /* Next unparsed byte of the header */
const u8 *zEndHdr; /* Pointer to first byte after the header */
u64 offset64; /* 64-bit offset */
u32 t; /* A type code from the record header */
Mem *pReg; /* PseudoTable input register */
**
** P2 is a register that holds the name of a virtual table in database
** P1. Call the xCreate method for that table.
*/
case OP_VCreate: {
Mem sMem; /* For storing the record being decoded */
const char *zTab; /* Name of the virtual table */
memset(&sMem, 0, sizeof(sMem));
sMem.db = db;
/* Because P2 is always a static string, it is impossible for the
** Attempt the transfer optimization on INSERTs of the form
**
** INSERT INTO tab1 SELECT * FROM tab2;
**
** The xfer optimization transfers raw records from tab2 over to tab1.
** Columns are not decoded and reassembled, which greatly improves
** performance. Raw index records are transferred in the same way.
**
** The xfer optimization is only attempted if tab1 and tab2 are compatible.
** There are lots of rules for determining compatibility - see comments
** embedded in the code for details.
/*
** Convert raw bits from the on-disk RTree record into a coordinate value.
** The on-disk format is big-endian and needs to be converted for little-
** endian platforms. The on-disk record stores integer coordinates if
** eInt is true and it stores 32-bit floating point records if eInt is
** false. a[] is the four bytes of the on-disk record to be decoded.
** Store the results in "r".
**
** There are five versions of this macro. The last one is generic. The
** other four are various architectures-specific optimizations.
*/
#if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
#define RTREE_DECODE_COORD(eInt, a, r) { \
RtreeCoord c; /* Coordinate decoded */ \
c.u = _byteswap_ulong(*(u32*)a); \
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
}
#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
#define RTREE_DECODE_COORD(eInt, a, r) { \
RtreeCoord c; /* Coordinate decoded */ \
c.u = __builtin_bswap32(*(u32*)a); \
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
}
#elif SQLITE_BYTEORDER==1234
#define RTREE_DECODE_COORD(eInt, a, r) { \
RtreeCoord c; /* Coordinate decoded */ \
memcpy(&c.u,a,4); \
c.u = ((c.u>>24)&0xff)|((c.u>>8)&0xff00)| \
((c.u&0xff)<<24)|((c.u&0xff00)<<8); \
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
}
#elif SQLITE_BYTEORDER==4321
#define RTREE_DECODE_COORD(eInt, a, r) { \
RtreeCoord c; /* Coordinate decoded */ \
memcpy(&c.u,a,4); \
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
}
#else
#define RTREE_DECODE_COORD(eInt, a, r) { \
RtreeCoord c; /* Coordinate decoded */ \
c.u = ((u32)a[0]<<24) + ((u32)a[1]<<16) \
+((u32)a[2]<<8) + a[3]; \
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
}
#endif
static void fts5DecodeFunction(
sqlite3_context *pCtx, /* Function call context */
int nArg, /* Number of args (always 2) */
sqlite3_value **apVal /* Function arguments */
){
i64 iRowid; /* Rowid for record being decoded */
int iSegid,iHeight,iPgno,bDlidx;/* Rowid components */
const u8 *aBlob; int n; /* Record to decode */
u8 *a = 0;
Fts5Buffer s; /* Build up text to return here */
int rc = SQLITE_OK; /* Return code */
view all matches for this distribution
view release on metacpan or search on metacpan
sqlite-amalgamation.c view on Meta::CPAN
#define PTF_LEAF 0x08
/*
** As each page of the file is loaded into memory, an instance of the following
** structure is appended and initialized to zero. This structure stores
** information about the page that is decoded from the raw file page.
**
** The pParent field points back to the parent page. This allows us to
** walk up the BTree from any leaf to the root. Care must be taken to
** unref() the parent page pointer when this page is no longer referenced.
** The pageDestructor() routine handles that chore.
sqlite-amalgamation.c view on Meta::CPAN
u32 *aType; /* aType[i] holds the numeric type of the i-th column */
u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */
u32 nField; /* number of fields in the record */
int len; /* The length of the serialized data for the column */
int i; /* Loop counter */
char *zData; /* Part of the record being decoded */
Mem *pDest; /* Where to write the extracted value */
Mem sMem; /* For storing the record being decoded */
sMem.flags = 0;
sMem.db = 0;
sMem.zMalloc = 0;
assert( p1<p->nCursor );
sqlite-amalgamation.c view on Meta::CPAN
**
** (6) The SELECT statement is a simple (not a compound) select that
** contains only tab2 in its FROM clause
**
** This method for implementing the INSERT transfers raw records from
** tab2 over to tab1. The columns are not decoded. Raw records from
** the indices of tab2 are transfered to tab1 as well. In so doing,
** the resulting tab1 has much less fragmentation.
**
** This routine returns TRUE if the optimization is attempted. If any
** of the conditions above fail so that the optimization should not
sqlite-amalgamation.c view on Meta::CPAN
static void dlrDestroy(DLReader *pReader){
SCRAMBLE(pReader);
}
#ifndef NDEBUG
/* Verify that the doclist can be validly decoded. Also returns the
** last docid found because it is convenient in other assertions for
** DLWriter.
*/
static void docListValidate(DocListType iType, const char *pData, int nData,
sqlite_int64 *pLastDocid){
sqlite-amalgamation.c view on Meta::CPAN
** case the first item would be delta-encoded.
**
** iLastDocid is the final docid in the doclist in pData. It is
** needed to create the new iPrevDocid for future delta-encoding. The
** code could decode the passed doclist to recreate iLastDocid, but
** the only current user (docListMerge) already has decoded this
** information.
*/
/* TODO(shess) This has become just a helper for docListMerge.
** Consider a refactor to make this cleaner.
*/
sqlite-amalgamation.c view on Meta::CPAN
}
/*******************************************************************/
/* PLReader is used to read data from a document's position list. As
** the caller steps through the list, data is cached so that varints
** only need to be decoded once.
**
** plrInit, plrDestroy - create/destroy a reader.
** plrColumn, plrPosition, plrStartOffset, plrEndOffset - accessors
** plrAtEnd - at end of stream, only call plrDestroy once true.
** plrStep - step to the next element.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/SQLite.pm view on Meta::CPAN
binary data, pre-encoded UTF-8 strings, etc.
=item * DBD_SQLITE_STRING_MODE_UNICODE_FALLBACK: All Perl strings are encoded
to UTF-8 before being given to SQLite. Perl will B<try> to decode SQLite
strings as UTF-8 when giving them to Perl. Should any such string not be
valid UTF-8, a warning is thrown, and the string is left undecoded.
This is appropriate for strings that are decoded to characters via,
e.g., L<Encode/decode>.
Also note that, due to some bizarreness in SQLite's type system (see
L<https://www.sqlite.org/datatype3.html>), if you want to retain
blob-style behavior for B<some> columns under DBD_SQLITE_STRING_MODE_UNICODE_FALLBACK
lib/DBD/SQLite.pm view on Meta::CPAN
SELECT * FROM foo ORDER BY name COLLATE perllocale
=head2 Unicode handling
Depending on the C<< $dbh->{sqlite_string_mode} >> value, strings coming
from the database and passed to the collation function may be decoded as
UTF-8. This only works, though, if the C<sqlite_string_mode> attribute is
set B<before> the first call to a perl collation sequence. The recommended
way to activate unicode is to set C<sqlite_string_mode> at connection time:
my $dbh = DBI->connect(
view all matches for this distribution
view release on metacpan or search on metacpan
for (i = 0; i < numFields; i++) {
char *val = imp_sth->results[i];
/* warn("fetching: %d == %s\n", i, val); */
if (val != NULL) {
size_t len = strlen(val);
char *decoded;
if (chopBlanks) {
val = savepv(val);
while(len > 0 && val[len-1] == ' ') {
len--;
}
val[len] = '\0';
}
decoded = sqlite2_decode(imp_dbh, val, &len);
sv_setpvn(AvARRAY(av)[i], decoded, len);
Safefree(decoded);
if (chopBlanks) Safefree(val);
/* if (!imp_dbh->no_utf8_flag) {
sv_utf8_encode(AvARRAY(av)[i]);
} */
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XBase/Index.pm view on Meta::CPAN
(this -type option may not work with all index formats at the moment
-- will be fixed and patches always welcome).
You can use C<-ddebug> option to indexdump to see how pages are
fetched and decoded, or run debugger to see the calls and parsing.
=head2 Using the index files to speed up searches in dbf
The syntax for using the index files to access data in the dbf file is
generally
view all matches for this distribution
view release on metacpan or search on metacpan
cci-src/src/cci/cci_handle_mng.c view on Meta::CPAN
for (i = 0; i < fetched_tuple; i++)
{
#if defined(WINDOWS)
for (j = 0; j < req_handle->num_col_info; j++)
{
FREE_MEM (req_handle->tuple_value[i].decoded_ptr[j]);
}
FREE_MEM (req_handle->tuple_value[i].decoded_ptr);
#endif
FREE_MEM (req_handle->tuple_value[i].column_ptr);
}
FREE_MEM (req_handle->tuple_value);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/mysql.pm view on Meta::CPAN
$sth->bind_param(2, $byte_param, DBI::SQL_BINARY); # set correct binary type
$sth->execute();
my $output = $sth->fetchall_arrayref();
# returned data in $output reference should be already UTF-8 decoded as appropriate
=item mysql_enable_utf8mb4
This is similar to mysql_enable_utf8, but is capable of handling 4-byte
UTF-8 characters.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBGp/Client/Response.pod view on Meta::CPAN
=item type
=item content
decoded content
=back
=head2 notify
lib/DBGp/Client/Response.pod view on Meta::CPAN
It always returns C<0> unless C<children> is true
=item value
The decoded value of scalar properties (typically useful when
C<children> is false).
=item childs
Array of C<DBGp::Client::Response::Property> objects. Returns an empty
view all matches for this distribution
view release on metacpan or search on metacpan
ex/unicode_test.pl view on Meta::CPAN
# NOTE: some DBs may uppercase table names
sub find_table {
my ($h, $table) = @_;
# won't find a match if the returned data is not utf8 decoded
my $s = $h->table_info(undef, undef, undef, 'TABLE');
my $r = $s->fetchall_arrayref;
my $found = first { $_->[2] =~ /$table/i} @$r;
ok($found, 'unicode table found in unqualified table_info');
SKIP: {
skip "table found via table_info", 1 if $found;
$found = first { Encode::decode_utf8($_->[2]) =~ /$table/i} @$r;
ok(!$found, "Table not found initially but when table name decoded it was found as $table");
};
my $found_some_utf8_tables;
foreach ($r) {
$found_some_utf8_tables++ if Encode::is_utf8($_->[2]);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/UTF8Columns.pm view on Meta::CPAN
$self->next::method( $column, $value );
return $copy || $value;
}
# override this if you want to force everything to be encoded/decoded
sub _is_utf8_column {
# my ($self, $col) = @_;
return ($_[0]->utf8_columns || {})->{$_[1]};
}
view all matches for this distribution