view release on metacpan or search on metacpan
lib/Alvis/URLs.pm view on Meta::CPAN
use POSIX;
use Encode;
use URI;
# encoding pragmas follow any includes like "use"
use encoding 'utf8';
use open ':utf8';
# return 32-bit unsigned
sub easyhash32
{
my $string = shift;
Encode::_utf8_off($string);
my $dig = md5_hex($string);
# print $dig . " \n";
return POSIX::strtol(substr($dig,0,8),16);
}
# return 64-bit unsigned
sub easyhash64char
{
my $string = shift;
Encode::_utf8_off($string);
my $dig = md5_hex($string);
# print $dig . " \n";
return substr($dig,0,16);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alvis/Buffer.pm view on Meta::CPAN
use strict;
use warnings;
use Time::Simple;
use encoding 'utf8';
use open ':utf8';
binmode STDIN, ":utf8";
binmode STDERR, ":utf8";
our $VERSION = '0.10';
=head1 NAME
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
$rec = $records[$i];
($id,$docR)=@$rec;
warn "Process document $id\n";
open FILETMP_OUT, ">$tmpfile";
binmode(FILETMP_OUT, ":utf8");
# binmode(FILETMP_OUT);
# print FILETMP_OUT Encode::decode_utf8($doc);
Alvis::NLPPlatform::platform_reset();
$render_time = Alvis::NLPPlatform::standalone_main($config, $docR, \*FILETMP_OUT, 1); #${$tab_docs_xml->[$doc_num]}[1] ; ${$ref_doc}[1]
close(FILETMP_OUT);
open FILETMP_OUT, "$tmpfile" or die "No such file or directory\n";
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
# PeerPort => $nlp_port,
# Proto => 'tcp');
# die "Could not create socket: $!\n" unless $sock;
$sock -> autoflush(1); ###############
binmode($sock, ":utf8");
print STDERR `date`;
print STDERR "Established connection to server.\n";
print STDERR "Requesting document...";
print $sock "REQUEST\n";
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
} while(!defined($sock) && ($connection_retry >0));
if ($connection_retry ==0) {
die "Timeout. Could not create socket: $! \n";
}
binmode $sock, ":utf8";
print STDERR "Established connection to server.\n";
print STDERR "Giving back annotated document...\n";
# Communitation with the server
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
if ($connection_retry ==0) {
die "Timeout. Could not create socket: $! \n";
}
$sock -> autoflush(1); ###############
binmode $sock, ":utf8";
print STDERR "Established connection to server.\n";
print STDERR "Sending aborting message\n";
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
# await client connection
if ($client_sock=$sock->accept()) {
warn "Accepting a connection\n";
if (fork() == 0) {
close($sock);
binmode($client_sock, ":utf8");
my ($client_port,$client_iaddr) = sockaddr_in(getpeername($client_sock));
warn "Getting information about remote host\n";
$name=gethostbyaddr($client_iaddr,AF_INET);
&disp_log($name,"Client (".inet_ntoa($client_iaddr).":".$client_port.") has connected.");
$client_sock -> autoflush(1); ###############
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
if (defined($id))
{
warn "Received\t$n\t$id\n";
`date`;
if (defined(open(I,">:utf8",$config{"ALVISTMP"} . "/${id}.xml")))
{
print I $xml;
close(I);
}
else
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
$sub_dir=&sub_dir_from_id($id);
if ($config{"NLP_misc"}->{"SAVE_IN_OUTDIR"}) {
mkpath( $config{"alvis_connection"}->{"OUTDIR"} . "/$sub_dir");
}
my $xml = "";
if (($config{"NLP_misc"}->{"SAVE_IN_OUTDIR"} == 0) || (defined(open(O,">:utf8", $config{"alvis_connection"}->{"OUTDIR"} . "/$sub_dir/${id}.xml"))))
{
while((defined $sock) && ($line=<$client_sock>) && ($line ne "<DONE>\n")) {
# recording the annotation document (local)
# building xml string for sending to the next step
$xml .= $line;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alvis/Pipeline/Read.pm view on Meta::CPAN
$lastread++;
my $filename = "$dir/$lastread";
my $f2 = new IO::File("<$filename")
or die "can't read file '$filename': $!";
binmode $f2, ":utf8";
my $doc = join("", <$f2>);
$f2->close();
unlink($filename);
$this->_write_and_unlock($dir, $fh, $lastread, $lastwrite);
lib/Alvis/Pipeline/Read.pm view on Meta::CPAN
while (1) {
$this->log(1, "accepting connection");
$this->{socket} = $listener->accept()
or die "can't accept connection: $!";
binmode $this->{socket}, ":utf8";
$this->log(1, "started background process, pid $$");
while (1) {
my $doc = $this->_read();
last if !defined $doc;
$this->_store_file($doc);
lib/Alvis/Pipeline/Read.pm view on Meta::CPAN
$lastwrite++;
my $filename = "$dir/$lastwrite";
my $f2 = new IO::File(">$filename")
or die "can't create new file '$filename': $!";
binmode $f2, ":utf8";
$f2->print($doc) or die "can't write '$filename': $!";
$f2->close() or die "can't close '$filename': $!";
$this->_write_and_unlock($dir, $fh, $lastread, $lastwrite);
}
view all matches for this distribution
view release on metacpan or search on metacpan
bin/run_QF.pl view on Meta::CPAN
my $f = shift();
my $canonise = shift();
my %dict = ();
my %line = ();
if (!defined(open(F,"<:utf8",$f)))
{
return undef;
}
while (my $l=<F>)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alvis/TermTagger.pm view on Meta::CPAN
use strict;
use warnings;
use utf8;
# TODO : write functions for term tagginga, term selection with and
# without offset in the corpus
sub termtagging {
lib/Alvis/TermTagger.pm view on Meta::CPAN
warn "Loading the terminological resource\n";
open DESC_TERMLIST, $termlist_name or die "$0: $termlist_name: No such file\n";
binmode(DESC_TERMLIST, ":utf8");
while($line1 = <DESC_TERMLIST>) {
chomp $line1;
utf8::decode($line1);
$line=$line1;
# Blank and comment lines are throw away
if (($line !~ /^\s*\#/o)&&($line !~ /^\s*\/\//o)&&($line !~ /^\s*$/o)) {
# Term is split from the other information
lib/Alvis/TermTagger.pm view on Meta::CPAN
warn "Loading the corpus\n";
open CORPUS, $corpus_filename or die "File $corpus_filename not found\n";
binmode(CORPUS, ":utf8");
while($line=<CORPUS>){
$lineLen = length($line);
chomp $line;
$ref_tabh_Corpus->{$sent_id}->{'line'} = $line;
lib/Alvis/TermTagger.pm view on Meta::CPAN
warn "Term tagging\n";
open TAGGEDCORPUS, ">>$offset_tagged_corpus_name" or die "$0: $offset_tagged_corpus_name: No such file\n";
binmode(TAGGEDCORPUS, ":utf8");
foreach $counter (keys %$ref_tabh_idtrm_select) {
$term_regex = $ref_regex_termlist->[$counter];
$termField2 = 0;
if (defined $ref_termlist->[$counter]->[$termField]) {
lib/Alvis/TermTagger.pm view on Meta::CPAN
warn "Term tagging ($offset_tagged_corpus_name)\n";
open TAGGEDCORPUS, ">$offset_tagged_corpus_name" or die "$0: $offset_tagged_corpus_name: No such file\n";
binmode(TAGGEDCORPUS, ":utf8");
if (!defined $termField) {
$termField = 0;
}
view all matches for this distribution
view release on metacpan or search on metacpan
rt.cpan.org.
ENHANCEMENTS:
- Allow any key starting with "pg_" when connecting a Postgres
database. This allows you to pass attributes like "pg_enable_utf8"
or "pg_bool_tf". Prompted by a discussion with Boris Shomodjvarac.
0.86 December 22, 2004
view all matches for this distribution
view release on metacpan or search on metacpan
package t::Util;
use strict;
use warnings;
use utf8;
use Exporter 'import';
our @EXPORT = qw/slurp/;
sub slurp {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/CloudFront/Thin.pm view on Meta::CPAN
return qq{<?xml version="1.0" encoding="UTF-8"?><InvalidationBatch xmlns="http://cloudfront.amazonaws.com/doc/2018-11-05/"><Paths><Quantity>$total_paths</Quantity><Items>$path_content</Items></Paths><CallerReference>$identifier</CallerReference><...
}
42;
__END__
=encoding utf8
=head1 NAME
Amazon::CloudFront::Thin - A thin, lightweight, low-level Amazon CloudFront client
lib/Amazon/CloudFront/Thin.pm view on Meta::CPAN
by URL Encoding the filenames. The following code takes a path such as
C<"events/Ø§ÙØ§Ø¨ØØ§Ø«"> which contains both a slash to indicate a directory
boundary and a non-ascii filename and creates an invalidation:
use Amazon::CloudFront::Thin;
use URL::Encode qw( url_encode_utf8 );
my $cloudfront = Amazon::CloudFront::Thin::->new( ... );
my $encoded_filename = url_encode_utf8($path);
# "/" will be encoded as %2F, but we want it as "/"
$encoded_filename =~ s!%2F!/!g;
$cloudfront->create_invalidation( '/' . $encoded_filename );
view all matches for this distribution
view release on metacpan or search on metacpan
t/000-report-versions.t view on Meta::CPAN
# UTF Support?
sub HAVE_UTF8 () { $] >= 5.007003 }
BEGIN {
if ( HAVE_UTF8 ) {
# The string eval helps hide this from Test::MinimumVersion
eval "require utf8;";
die "Failed to load UTF-8 support" if $@;
}
# Class structure
require 5.004;
t/000-report-versions.t view on Meta::CPAN
} else {
# Strip UTF-8 bom if found, we'll just ignore it
$string =~ s/^\357\273\277//;
}
# Try to decode as utf8
utf8::decode($string) if HAVE_UTF8;
# Check for some special cases
return $self unless length $string;
unless ( $string =~ /[\012\015]+\z/ ) {
return $self->_error("Stream does not end with newline character");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/DynamoDB/Simple.pm view on Meta::CPAN
my %new;
for my $key (keys %item) {
my $value = $item{$key};
$new{$key} = $self->is_valid_json($value)
? JSON::XS->new->utf8->pretty->decode($value)
: $value;
}
return %new;
}
lib/Amazon/DynamoDB/Simple.pm view on Meta::CPAN
my %new;
for my $key (keys %item) {
my $value = $item{$key};
$new{$key} = ref $value
? JSON::XS->new->utf8->pretty->encode($value)
: $item{$key};
}
return %new;
}
sub is_valid_json {
my ($self, $json) = @_;
eval { JSON::XS->new->utf8->pretty->decode($json) };
return 0 if $@;
return 1;
}
sub permanent_delete {
view all matches for this distribution
view release on metacpan or search on metacpan
Author: Rusty Conover <rusty@luckydinosaur.com>
Date : 2014-06-22 14:47:31 +0000
Bump to version 0.14
Fix utf8 encode/decode for requests.
Change: 52be9b45c66952e5959617a5b30ad5a7e6ce4965
Author: Rusty Conover <rusty@luckydinosaur.com>
Date : 2014-05-23 18:15:13 +0000
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/MWS/Uploader.pm view on Meta::CPAN
package Amazon::MWS::Uploader;
use utf8;
use strict;
use warnings;
use DBI;
use Amazon::MWS::XML::Feed;
lib/Amazon/MWS/Uploader.pm view on Meta::CPAN
=item db_options
E.g.
{
mysql_enable_utf8 => 1,
}
AutoCommit and RaiseError are set by us.
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/PAApi5/Payload.pm view on Meta::CPAN
/) {
my $method = decamelize($k);
$hash->{$k} = $self->$method;
}
return JSON::to_json($hash, { utf8 => 0, canonical => 1 });
}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3/Thin/Credentials.pm view on Meta::CPAN
use Carp;
use JSON::PP ();
use LWP::UserAgent;
my $JSON = JSON::PP->new->utf8->canonical;
sub new {
my ($class, $key, $secret, $session_token) = @_;
my $self = {
key => $key,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3.pm view on Meta::CPAN
use URI;
use LWP::UserAgent::Determined;
use MIME::Base64 qw(encode_base64 decode_base64);
use Scalar::Util qw( reftype blessed );
use List::Util qw( any pairs );
use URI::Escape qw(uri_escape_utf8);
use XML::Simple qw(XMLin); ## no critic (Community::DiscouragedModules)
use parent qw(Class::Accessor::Fast);
__PACKAGE__->mk_accessors(
lib/Amazon/S3.pm view on Meta::CPAN
########################################################################
sub _urlencode {
########################################################################
my ( $self, $unencoded ) = @_;
return uri_escape_utf8( $unencoded, '^A-Za-z0-9\-\._~\x2f' ); ## no critic (RequireInterpolation)
}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
- [Sergey Basmanov]
- Added SNS::Target and MobileAttributes
1.2 2013-08-24
- [Alessandro Zummo]
- add utf8 support
- use POST instead of GET, as a side-effect internal signing
has been implemented and thus Net::Amazon::AWSSign
is no more required.
- support different messages for different destinations, the $message
parameter must be an hashref
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SNS.pm view on Meta::CPAN
# build URI
my $uri = URI->new($self->service);
$uri->path('/');
$uri->query(join('&', map { $_ . '=' . URI::Escape::uri_escape_utf8($args->{$_}, '^A-Za-z0-9\-_.~') } sort keys %$args ));
# create signature
$args->{'Signature'} = hmac_sha256_base64(join("\n", 'POST', $uri->host, $uri->path, $uri->query), $self->secret);
# padding
while (length($args->{'Signature'}) % 4) {
$args->{'Signature'} .= '=';
}
# rewrite query string
$uri->query(join('&', map { $_ . '=' . URI::Escape::uri_escape_utf8($args->{$_}, '^A-Za-z0-9\-_.~') } sort keys %$args ));
my $response = LWP::UserAgent->new->post($self->service, 'Content' => $uri->query);
$self->status_code($response->code);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SQS/Client.pm view on Meta::CPAN
########################################################################
sub _urlencode {
########################################################################
my ( $self, $value, $path ) = @_;
use URI::Escape qw(uri_escape_utf8);
my $escapepattern = '^A-Za-z0-9\-_.~';
if ($path) {
$escapepattern = $escapepattern . $SLASH;
}
return uri_escape_utf8( $value, $escapepattern );
}
#
# Computes RFC 2104-compliant HMAC signature.
#
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SQS/Consumer.pm view on Meta::CPAN
use strict;
use warnings;
use base 'Amazon::SQS::ProducerConsumer::Base';
use JSON::XS;
use Encode qw( encode_utf8 is_utf8 );
use constant {
DEFAULT_N_MESSAGES => 10,
DEFAULT_WAIT_SECONDS => 30,
SECONDS_BETWEEN_TRIES => 10
lib/Amazon/SQS/Consumer.pm view on Meta::CPAN
if ( my $message = shift @{$me->{messages}} ) {
$me->{DeleteMessageHandle} = $message->{ReceiptHandle};
my $object;
eval {
my $body = $message->{Body};
$body = encode_utf8( $body ) if is_utf8( $body );
$object = decode_json $body;
};
if ( $@ ) {
say "left bad message in queue; could not decode JSON from $message->{Body}: $@";
} else {
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
use strict;
use warnings;
use ExtUtils::MakeMaker;
use 5.0073; # for Encode/utf8
WriteMakefile(
NAME => 'Amazon::SQS::Simple',
AUTHOR => 'Simon Whitaker <sw@netcetera.org>',
VERSION_FROM => 'lib/Amazon/SQS/Simple.pm',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ambassador/API/V2/Role/HasJSON.pm view on Meta::CPAN
# Configure and cache the JSON object
has json => (
is => 'ro',
default => sub {
return JSON->new->utf8(1);
}
);
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ambrosia/DataProvider.pm view on Meta::CPAN
source_name => 'Employee',
engine_params => 'database=EmployeeDB;host=localhost;',
user => 'test',
password => 'test',
additional_params => { AutoCommit => 0, RaiseError => 1, LongTruncOk => 1 },
additional_action => sub { my $dbh = shift; $dbh->do('SET NAMES utf8')},
},
#........
],
IO => [
{
view all matches for this distribution
view release on metacpan or search on metacpan
factpacks/Linux.fact view on Meta::CPAN
WebCalendar => <reply> $who, WebCalendar is a PHP/MySQL application used to maintain a calendar for one or more persons.. URL: http://www.radix.net/~cknudsen/webcalendar/files/WebCalendar-0.9.tar.gz
SDCC-z80 => <reply> $who, SDCC-z80 is a version of the optimising C compiler SDCC targeted to the 8 bit Zilog Z80. URL: http://earthling.net.nz/~michaelh/snapshots/
SPS4Linux => <reply> $who, SPS4Linux is an implementation of the SPS Language. URL: http://www.eilers.net/sps/
XMagick => <reply> $who, XMagick is a library written in C which allows integration of the ImageMagick library with any X application by providing functions which convert between the native X image format (XImage) and the native ImageMagick format (I...
libiconv => <reply> $who, libiconv provides an iconv() implementation for use on systems which don't have one or whose implementation cannot convert from/to Unicode. URL: ftp://ftp.ilog.fr/pub/Users/haible/gnu/libiconv-0.1.tar.gz
libutf8 => <reply> $who, libutf8 provides UTF-8 locale support for use on systems which don't have UTF-8 locales or whose UTF-8 locales are unreasonably slow. URL: ftp://ftp.ilog.fr/pub/Users/haible/utf8/libutf8-0.6.1.tar.gz
as-gps => <reply> $who, as-gps contains a basic support library for accessing the inexpensive ($20) Aisin-Seiki GPS Module previously available at mavin.com. URL: http://www.amphibious.org/gps/as-gps-0.2.tgz
E8Ball => <reply> $who, E8Ball is an epplet that responds to questions you ask it. URL: http://free.house.cx/~adrian/epplets/
gmap => <reply> $who, gmap is a map viewer with emphasis on temporal data. URL: http://academy.cas.cz/~gis/dload.html
keeper => <reply> $who, The keeper library provides a simple-to-use C interface for reading and writing configuration data. URL: http://www.inf.bme.hu/~mszeredi/keeper/keeper.html#dist
BHRPFF => <reply> $who, Ben Hates Reading Poorly Formatted Filenames, or BHRPFF, is a Perl script that will help you to rename your mp3 files so that they are more readable. URL: http://my.yi.org/~brain/bhrpff/bhrpff.tar.gz
view all matches for this distribution
view release on metacpan or search on metacpan
use 5.008_001;
use strict;
use warnings;
use utf8;
use Module::Build;
use File::Basename;
use File::Spec;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amon2/Auth/Site/Hatena.pm view on Meta::CPAN
1;
__END__
=encoding utf8
=head1 NAME
Amon2::Auth::Site::Hatena - Hatena authentication integration for Amon2
view all matches for this distribution
view release on metacpan or search on metacpan
use 5.008_001;
use strict;
use warnings;
use utf8;
use Module::Build;
use File::Basename;
use File::Spec;
use CPAN::Meta;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amon2/Auth/Site/LINE.pm view on Meta::CPAN
package Amon2::Auth::Site::LINE;
use strict;
use warnings;
use utf8;
use URI;
use JSON;
use Mouse;
use LWP::UserAgent;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amon2/Auth.pm view on Meta::CPAN
our $VERSION = '0.07';
1;
__END__
=encoding utf8
=head1 NAME
Amon2::Auth - Authentication module for Amon2
view all matches for this distribution
view release on metacpan or search on metacpan
author/assets.pl view on Meta::CPAN
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use 5.008001;
use lib 'lib';
use LWP::UserAgent;
use autodie;
use Data::Dumper;
author/assets.pl view on Meta::CPAN
return data ? fn( data ) : fn;
};
})();
...
open my $fh, '>:utf8', 'lib/Amon2/Setup/Asset/MicroTemplateJS.pm';
print {$fh} $xslate->render_string(<<'...', +{ file => $0, basename => 'micro_template.js', data => Dumper({ 'js/micro_template.js' => $content})});
# This file is generated by <% file %>. Do not edit manually.
package Amon2::Setup::Asset::MicroTemplateJS;
use strict;
use warnings;
author/assets.pl view on Meta::CPAN
my $res = $ua->get($url);
$res->is_success or die "Cannot fetch $url: " . $res->status_line;
my $content = $res->decoded_content;
open my $fh, '>:utf8', "lib/Amon2/Setup/Asset/${name}.pm";
print {$fh} $xslate->render_string(<<'...', +{ file => $0, basename => basename($url), name => $name, data => Dumper({ 'js/' . basename($url) => $content})});
# This file is generated by <% file %>. Do not edit manually.
package Amon2::Setup::Asset::<% name %>;
use strict;
use warnings;
author/assets.pl view on Meta::CPAN
my $url = 'http://code.jquery.com/jquery-3.6.1.min.js';
my $res = $ua->get($url);
$res->is_success or die "Cannot fetch $url: " . $res->status_line;
my $jquery = $res->decoded_content;
open my $fh, '>:utf8', 'lib/Amon2/Setup/Asset/jQuery.pm';
print {$fh} $xslate->render_string(<<'...', +{ file => $0, basename => basename($url), data => Dumper({ 'js/' . basename($url) => $jquery})});
# This file is generated by <% file %>. Do not edit manually.
package Amon2::Setup::Asset::jQuery;
use strict;
use warnings;
author/assets.pl view on Meta::CPAN
}
1;
...
open my $fh, '>:utf8', 'lib/Amon2/Setup/Asset/Bootstrap.pm';
print {$fh} $content;
close $fh;
eval "use Amon2::Setup::Asset::Bootstrap;";
die $@ if $@;
view all matches for this distribution