view release on metacpan or search on metacpan
lib/Digest/MD5.pm view on Meta::CPAN
object will be in. The addfile() method might have been able to read
the file partially before it failed. It is probably wise to discard
or reset the $md5 object if this occurs.
In most cases you want to make sure that the $io_handle is in
C<binmode> before you pass it as argument to the addfile() method.
=item $md5->add_bits($data, $nbits)
=item $md5->add_bits($bitstring)
lib/Digest/MD5.pm view on Meta::CPAN
use Digest::MD5;
my $filename = shift || "/etc/passwd";
open (my $fh, '<', $filename) or die "Can't open '$filename': $!";
binmode($fh);
my $md5 = Digest::MD5->new;
while (<$fh>) {
$md5->add($_);
}
lib/Digest/MD5.pm view on Meta::CPAN
use Digest::MD5;
my $filename = shift || "/etc/passwd";
open (my $fh, '<', $filename) or die "Can't open '$filename': $!";
binmode ($fh);
print Digest::MD5->new->addfile($fh)->hexdigest, " $filename\n";
Since the MD5 algorithm is only defined for strings of bytes, it can not be
used on strings that contains chars with ordinal number above 255 (Unicode
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Capture/Tiny.pm view on Meta::CPAN
my ($fh, $layers) = @_;
# _debug("# requested layers (@{$layers}) for @{[fileno $fh]}\n");
my %seen = ( unix => 1, perlio => 1 ); # filter these out
my @unique = grep { !$seen{$_}++ } @$layers;
# _debug("# applying unique layers (@unique) to @{[fileno $fh]}\n");
binmode($fh, join(":", ":raw", @unique));
}
sub _name {
my $glob = shift;
no strict 'refs'; ## no critic
inc/Capture/Tiny.pm view on Meta::CPAN
_open \*STDIN, "<" . File::Spec->devnull;
# _debug( "# proxied STDIN as " . (defined fileno STDIN ? fileno STDIN : 'undef' ) . "\n" );
_open $dup{stdin} = IO::Handle->new, "<&=STDIN";
}
$proxies{stdin} = \*STDIN;
binmode(STDIN, ':utf8') if $] >= 5.008;
}
if ( ! defined fileno STDOUT ) {
$proxy_count{stdout}++;
if (defined $dup{stdout}) {
_open \*STDOUT, ">&=" . fileno($dup{stdout});
inc/Capture/Tiny.pm view on Meta::CPAN
_open \*STDOUT, ">" . File::Spec->devnull;
# _debug( "# proxied STDOUT as " . (defined fileno STDOUT ? fileno STDOUT : 'undef' ) . "\n" );
_open $dup{stdout} = IO::Handle->new, ">&=STDOUT";
}
$proxies{stdout} = \*STDOUT;
binmode(STDOUT, ':utf8') if $] >= 5.008;
}
if ( ! defined fileno STDERR ) {
$proxy_count{stderr}++;
if (defined $dup{stderr}) {
_open \*STDERR, ">&=" . fileno($dup{stderr});
inc/Capture/Tiny.pm view on Meta::CPAN
_open \*STDERR, ">" . File::Spec->devnull;
# _debug( "# proxied STDERR as " . (defined fileno STDERR ? fileno STDERR : 'undef' ) . "\n" );
_open $dup{stderr} = IO::Handle->new, ">&=STDERR";
}
$proxies{stderr} = \*STDERR;
binmode(STDERR, ':utf8') if $] >= 5.008;
}
return %proxies;
}
sub _unproxy {
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-compile.t view on Meta::CPAN
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Tickit/Style.pm view on Meta::CPAN
sub load_style_file
{
shift;
my ( $path ) = @_;
# TODO: use ->from_file( $path, binmode => ":encoding(UTF-8)" ) when available
my $str = do {
open my $fh, "<:encoding(UTF-8)", $path or croak "Cannot read $path - $!";
local $/;
<$fh>;
};
view all matches for this distribution
view release on metacpan or search on metacpan
div128|||
djSP|||
do_aexec5|||
do_aexec|||
do_aspawn|||
do_binmode||5.004050|
do_chomp|||
do_chop|||
do_close|||
do_dump_pad|||
do_eof|||
view all matches for this distribution
view release on metacpan or search on metacpan
bin/linkBags view on Meta::CPAN
select((select(STDERR), $| = 1)[0]);
# encoding pragmas follow any includes like "use"
use encoding 'utf8';
use open ':utf8';
binmode STDIN, ":utf8";
binmode STDERR, ":utf8";
# command line inputs
my $gzip = 0;
my $stem = "";
my $file = "";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alvis/Buffer.pm view on Meta::CPAN
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);
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); ###############
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
lib/Alvis/Treetagger.pm view on Meta::CPAN
use strict;
use warnings;
use encoding 'utf8';
use open ':utf8';
binmode STDERR, ":utf8";
our $commandLine;
our $taggerRoot;
our $FIFO;
our $parFile;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alvis/Saa.pm view on Meta::CPAN
$this->{'err'} = "$@";
close($inet_sock);
return 0;
}
binmode($inet_sock, ":raw");
binmode($unix_sock, ":raw");
$serv->{'inet_sock'} = $inet_sock;
$serv->{'unix_sock'} = $unix_sock;
$this->{'servs'}->{$port} = $serv;
lib/Alvis/Saa.pm view on Meta::CPAN
else
{
$debug && print STDERR "Saa::connect(): Successfully opened localsoc!\n";
}
binmode($conn, ":raw");
$cn->{'conn'} = $conn;
$this->{'conn_sel'}->add($conn);
$this->{'conns'}->{"${host}_$port"} = $cn;
view all matches for this distribution
view release on metacpan or search on metacpan
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;
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
t/00-compile.t view on Meta::CPAN
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
view all matches for this distribution
view release on metacpan or search on metacpan
t/job-selection.t view on Meta::CPAN
use Data::Dumper;
use Test::More;
use DateTime;
use DBI;
binmode STDOUT, ':utf8';
binmode STDERR, ':utf8';
my $feed_dir = 't/feeds';
if (-d 'schemas') {
plan tests => 12;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3/Bucket.pm view on Meta::CPAN
if !-r $filename || !$remaining;
my $fh = IO::File->new( $filename, 'r' )
or croak "Could not open $filename: $OS_ERROR";
$fh->binmode;
return sub {
my $buffer;
# upon retries the file is closed and we must reopen it
if ( !$fh->opened ) {
$fh = IO::File->new( $filename, 'r' )
or croak "Could not open $filename: $OS_ERROR";
$fh->binmode;
$remaining = $stat->size;
}
my $read = $fh->read( $buffer, $blksize );
view all matches for this distribution
view release on metacpan or search on metacpan
DEV_NULL = > NUL
MKPATH = $(ABSPERLRUN) -MExtUtils::Command -e mkpath --
EQUALIZE_TIMESTAMP = $(ABSPERLRUN) -MExtUtils::Command -e eqtime --
FALSE = $(ABSPERLRUN) -e "exit 1" --
TRUE = $(ABSPERLRUN) -e "exit 0" --
ECHO = $(ABSPERLRUN) -l -e "binmode STDOUT, qq{{:raw}}; print qq{{@ARGV}}" --
ECHO_N = $(ABSPERLRUN) -e "print qq{{@ARGV}}" --
UNINST = 0
VERBINST = 0
MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e "install([ from_to => {{@ARGV}}, verbose => '$(VERBINST)', uninstall_shadows => '$(UNINST)', dir_mode => '$(PERM_DIR)' ]);" --
DOC_INSTALL = $(ABSPERLRUN) -MExtUtils::Command::MM -e perllocal_install --
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amon2/Setup/Flavor/Lite.pm view on Meta::CPAN
our @EXPORT = qw//;
{
# utf8 hack.
binmode Test::More->builder->$_, ":utf8" for qw/output failure_output todo_output/;
no warnings 'redefine';
my $code = \&Test::Builder::child;
*Test::Builder::child = sub {
my $builder = $code->(@_);
binmode $builder->output, ":utf8";
binmode $builder->failure_output, ":utf8";
binmode $builder->todo_output, ":utf8";
return $builder;
};
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Can.pm view on Meta::CPAN
require File::Temp;
my ( $FH, $tmpfile ) = File::Temp::tempfile(
"compilexs-XXXXX",
SUFFIX => '.c',
);
binmode $FH;
print $FH <<'END_C';
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
view all matches for this distribution
view release on metacpan or search on metacpan
share/flavor/Minimum/t/Util.pm view on Meta::CPAN
<% block export -> { } %>
);
{
# utf8 hack.
binmode Test::More->builder->$_, ":utf8" for qw/output failure_output todo_output/;
no warnings 'redefine';
my $code = \&Test::Builder::child;
*Test::Builder::child = sub {
my $builder = $code->(@_);
binmode $builder->output, ":utf8";
binmode $builder->failure_output, ":utf8";
binmode $builder->todo_output, ":utf8";
return $builder;
};
}
<% block functions -> { %>
view all matches for this distribution
view release on metacpan or search on metacpan
xs/const/ppport.h view on Meta::CPAN
dMY_CXT_SV|5.007003|5.003007|pV
dNOOP|5.006000|5.003007|p
do_aexec|5.009003||Viu
do_aexec5|5.006000||Viu
do_aspawn|5.008000||Vu
do_binmode|5.004005|5.004005|du
docatch|5.005000||Vi
do_chomp|5.003007||Viu
do_close|5.003007|5.003007|u
do_delete_local|5.011000||Viu
do_dump_pad|5.008001||Vi
xs/const/ppport.h view on Meta::CPAN
KEY_and|5.003007||Viu
KEY_atan2|5.003007||Viu
KEY_AUTOLOAD|5.003007||Viu
KEY_BEGIN|5.003007||Viu
KEY_bind|5.003007||Viu
KEY_binmode|5.003007||Viu
KEY_bless|5.003007||Viu
KEY_break|5.027008||Viu
KEY_caller|5.003007||Viu
KEY_catch|5.033007||Viu
KEY_chdir|5.003007||Viu
xs/const/ppport.h view on Meta::CPAN
my|5.011000||Viu
my_atof2|5.029000||cVu
my_atof3|5.029000||cVu
my_atof|5.006000|5.006000|
my_attrs|5.006000||Viu
my_binmode|5.006000||Viu
my_bytes_to_utf8|5.021009||Vniu
my_chsize|5.003007||Vu
my_clearenv|5.009003||Viu
MY_CXT|5.009000|5.009000|p
MY_CXT_CLONE|5.009002|5.009000|p
xs/const/ppport.h view on Meta::CPAN
PERL_INVLIST_INLINE_H|5.029006||Viu
PerlIO|5.003007||Viu
PerlIO_apply_layers|5.007001|5.007001|
PerlIOArg|5.007001||Viu
PerlIOBase|5.007001||Viu
PerlIO_binmode|5.007001|5.007001|
PERLIOBUF_DEFAULT_BUFSIZ|5.013007||Viu
PerlIO_canset_cnt|5.003007|5.003007|n
PerlIO_clearerr|5.007003|5.007003|
PerlIO_close|5.007003|5.007003|
PerlIO_context_layers|||u
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Android/Build.pm view on Meta::CPAN
# Tests and documentation
sub test
{my $p = __PACKAGE__;
binmode($_, ":utf8") for *STDOUT, *STDERR;
return if eval "eof(${p}::DATA)";
my $s = eval "join('', <${p}::DATA>)";
$@ and die $@;
eval $s;
$@ and die $@;
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-compile.t view on Meta::CPAN
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
view all matches for this distribution
view release on metacpan or search on metacpan
src/ppport.h view on Meta::CPAN
div128|||
djSP|||
do_aexec5|||
do_aexec|||
do_aspawn|||
do_binmode||5.004050|
do_chomp|||
do_close|||
do_delete_local|||
do_dump_pad|||
do_eof|||
view all matches for this distribution
view release on metacpan or search on metacpan
my $isWin = $FALSE;
my $pltFrm = $^O;
if ($pltFrm =~ /win32/i) {
$pltFrm = "MSWIN";
$isWin = $TRUE;
binmode(STDOUT, ":encoding(cp437)"); # für die korrekte Darstellung deutscher Umlaute
}
else {
$pltFrm = "UNIX";
}
my $ed = Ante::Deluvian::Dialog->new(
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/00-compile.t view on Meta::CPAN
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyData/Storage/File.pm view on Meta::CPAN
die "Cannot read file '$file': doesn't exist!" unless -f $file;
if (!($fh = IO::File->new($file, $mode{$open_mode}))) {
die " Cannot open '$file': $!";
}
}
binmode($fh);
$fh->autoflush(1);
if ( HAS_FLOCK ) {
if ( $open_mode eq 'r') {
if (!flock($fh, LOCK_SH)) {
die "Cannot obtain shared lock on '$file': $!";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyData2/Storage.pm view on Meta::CPAN
=head2 read
my $buf = $stor->read(<characters>)
Use binmode for characters as synonymous for bytes.
=cut
sub read
{
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Can.pm view on Meta::CPAN
require File::Temp;
my ( $FH, $tmpfile ) = File::Temp::tempfile(
"compilexs-XXXXX",
SUFFIX => '.c',
);
binmode $FH;
print $FH <<'END_C';
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_base.t view on Meta::CPAN
BEGIN {
# ÐодгоÑовка обÑекÑа ÑеÑÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð´Ð»Ñ ÑабоÑÑ Ñ utf8
my $builder = Test::More->builder;
binmode $builder->output, ":utf8";
binmode $builder->failure_output, ":utf8";
binmode $builder->todo_output, ":utf8";
# use_ok 'AnyEvent::Impl::EV';
use_ok 'AnyEvent';
use_ok 'AnyEvent::AggressiveIdle';
}
view all matches for this distribution
view release on metacpan or search on metacpan
util/gen_uts46data view on Meta::CPAN
use common::sense;
use utf8;
no warnings 'utf8';
binmode STDOUT, ":utf8";
open my $fh, "GET http://www.unicode.org/Public/idna/9.0.0/IdnaMappingTable.txt |"
or die;
my $valid;
util/gen_uts46data view on Meta::CPAN
}
}
open my $fh, ">lib/AnyEvent/Util/uts46data.pl"
or die;
binmode $fh, ":perlio";
print $fh "# autogenerated by util/gen_uts46data\n";
utf8::encode $imap;
0 > index $imap, "\x02" # it's not supposed to be anywhere in there
or die "imap contains \\x02";
view all matches for this distribution