view release on metacpan or search on metacpan
src/inc/version/vpp.pm view on Meta::CPAN
my $value = shift;
# may be a v-string
if ( length($value) >= 3 && $value !~ /[._]/
&& _is_non_alphanumeric($value)) {
my $tvalue;
if ( $] ge 5.008_001 ) {
$tvalue = _find_magic_vstring($value);
$value = $tvalue if length $tvalue;
}
elsif ( $] ge 5.006_000 ) {
$tvalue = sprintf("v%vd",$value);
if ( $tvalue =~ /^v\d+(\.\d+){2,}$/ ) {
# must be a v-string
$value = $tvalue;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/algorithm_odometer_tiny.t view on Meta::CPAN
} ), 0, 'no uninitialized warnings';
};
SKIP: {
skip "need Perl >= v5.18 for overloaded <> in list context",
2 if $] lt '5.018'; # [perl #47119]
my $odo1 = Algorithm::Odometer::Tiny->new( ['foo','bar'], [3..5] );
is_deeply [<$odo1>], ["foo3", "foo4", "foo5", "bar3", "bar4", "bar5"], 'list context <> ::Tiny';
my $odo2 = Algorithm::Odometer::Gray->new( ['a','b','c'],[1,2] );
is_deeply [<$odo2>], ["a1", "b1", "c1", "c2", "b2", "a2"], 'list context <> ::Gray';
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Inline/CPP.pm view on Meta::CPAN
my ($o, $value) = @_;
$value =~ s/^::|::$//g;
# Perl 5.12 indroduced \p{XID_Start} and \p{XID_Continue}. Prior to that
# we should downgrade gracefully.
my $ident = $] ge '5.0120'
? qr{[\p{XID_Start}_][\p{XID_Continue}_]*}
: qr{[\p{Alpha}_][\p{Alpha}\p{Digit}_]*};
croak "$value is an invalid package name."
unless length $value == 0
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Inline/CPP.pm view on Meta::CPAN
my ($o, $value) = @_;
$value =~ s/^::|::$//g;
# Perl 5.12 indroduced \p{XID_Start} and \p{XID_Continue}. Prior to that
# we should downgrade gracefully.
my $ident = $] ge '5.0120'
? qr{[\p{XID_Start}_][\p{XID_Continue}_]*}
: qr{[\p{Alpha}_][\p{Alpha}\p{Digit}_]*};
croak "$value is an invalid package name."
unless length $value == 0
view all matches for this distribution
view release on metacpan or search on metacpan
t/07-decl.t view on Meta::CPAN
ok( $cse->command()->hits() , "Ok got hits");
is( $cse->command()->hits()->total_hits() , 2 , "Ok two hits");
}
SKIP: {
skip "Perl too old.", 3 unless ( $] ge '5.14' );
## Searching for some method, but excluding the declaration
local @ARGV = ( '--idx='.$idx_dir, 'some_method', '-decl:some_method', '--dir='.$content_dir.'');
my $cse = App::CSE->new();
is( $cse->command()->execute(), 0 , "Ok execute has terminated just fine");
ok( $cse->command()->hits() , "Ok got hits");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/GhaInstall.pm view on Meta::CPAN
sub INSTALLER () {
return $installer if defined $installer;
if ( $ENV{GHA_INSTALL_BACKEND} ) {
$installer = $ENV{GHA_INSTALL_BACKEND};
}
elsif ( $] lt '5.008001' ) {
$installer = 'cpan';
}
else {
my $output = `cpanm --version`;
if ( $output =~ /cpanminus/ ) {
view all matches for this distribution
view release on metacpan or search on metacpan
kritika.fatpack view on Meta::CPAN
$fatpacked{"Test/MonkeyMock.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'TEST_MONKEYMOCK';
package Test::MonkeyMock;use strict;use warnings;require Carp;our$VERSION='0.05';my$registry={};my$magic_counter=0;sub new {my$class=shift;$class=ref$class if ref$class;my ($instance)=@_;my$new_package;if ($instance){$new_package=__PACKAGE__ .'::' ...
TEST_MONKEYMOCK
$fatpacked{"Test/TempDir/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'TEST_TEMPDIR_TINY';
use 5.006002;use strict;use warnings;package Test::TempDir::Tiny;our$VERSION='0.05';use Exporter 5.57 qw/import/;our@EXPORT=qw/tempdir in_tempdir/;use Carp qw/confess/;use Cwd qw/abs_path/;use Errno qw/EEXIST ENOENT/;{no warnings 'numeric';use File...
TEST_TEMPDIR_TINY
$fatpacked{"Try/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'TRY_TINY';
package Try::Tiny;use 5.006;our$VERSION='0.05';use strict;use warnings;use Exporter 5.57 'import';our@EXPORT=our@EXPORT_OK=qw(try catch finally);use Carp;$Carp::Internal{+__PACKAGE__}++;BEGIN {my$su=$INC{'Sub/Util.pm'}&& defined&Sub::Util::set_subn...
TRY_TINY
view all matches for this distribution
view release on metacpan or search on metacpan
requires 'Tie::IxHash';
suggests 'DBD::SQLite';
};
# MongoDB only supports 5.10+
unless ($] lt '5.010') {
feature 'recs-frommongo', 'MongoDB data source' => sub {
requires 'MongoDB';
requires 'JSON::PP';
};
}
feature 'recs-fromps', 'Process list data source' => sub {
requires 'Proc::ProcessTable';
};
# NetPacket only supports 5.10+
unless ($] lt '5.010') {
feature 'recs-fromtcpdump', 'Network packet capture parsing' => sub {
requires 'Net::DNS::Packet';
requires 'NetPacket::ARP';
requires 'NetPacket::Ethernet';
requires 'NetPacket::IP';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/cpanminus/fatscript.pm view on Meta::CPAN
sub save {
my ($self, $file, $options) = @_;
my $version = $options->{version} || '2';
my $layer = $] ge '5.008001' ? ':utf8' : '';
if ( $version ge '2' ) {
carp "'$file' should end in '.json'"
unless $file =~ m{\.json$};
}
lib/App/cpanminus/fatscript.pm view on Meta::CPAN
|| $request->{headers}{'transfer-encoding'};
$request->{cb} = $args->{content};
}
elsif ( length $args->{content} ) {
my $content = $args->{content};
if ( $] ge '5.008' ) {
utf8::downgrade($content, 1)
or die(qq/Wide character in request message body\n/);
}
$request->{headers}{'content-type'} ||= "application/octet-stream";
$request->{headers}{'content-length'} = length $content
lib/App/cpanminus/fatscript.pm view on Meta::CPAN
$escapes{' '}="+";
my $unsafe_char = qr/[^A-Za-z0-9\-\._~]/;
sub _uri_escape {
my ($self, $str) = @_;
if ( $] ge '5.008' ) {
utf8::encode($str);
}
else {
$str = pack("U*", unpack("C*", $str)) # UTF-8 encode a byte string
if ( length $str == do { use bytes; length $str } );
lib/App/cpanminus/fatscript.pm view on Meta::CPAN
sub write {
@_ == 2 || die(q/Usage: $handle->write(buf)/ . "\n");
my ($self, $buf) = @_;
if ( $] ge '5.008' ) {
utf8::downgrade($buf, 1)
or die(qq/Wide character in write()\n/);
}
my $len = length $buf;
lib/App/cpanminus/fatscript.pm view on Meta::CPAN
my $data = $request->{cb}->();
defined $data && length $data
or last;
if ( $] ge '5.008' ) {
utf8::downgrade($data, 1)
or die(qq/Wide character in write_content()\n/);
}
$len += $self->write($data);
lib/App/cpanminus/fatscript.pm view on Meta::CPAN
my $data = $request->{cb}->();
defined $data && length $data
or last;
if ( $] ge '5.008' ) {
utf8::downgrade($data, 1)
or die(qq/Wide character in write_chunked_body()\n/);
}
$len += length $data;
view all matches for this distribution
view release on metacpan or search on metacpan
sub save {
my ($self, $file, $options) = @_;
my $version = $options->{version} || '2';
my $layer = $] ge '5.008001' ? ':utf8' : '';
if ( $version ge '2' ) {
carp "'$file' should end in '.json'"
unless $file =~ m{\.json$};
}
|| $request->{headers}{'transfer-encoding'};
$request->{cb} = $args->{content};
}
else {
my $content = $args->{content};
if ( $] ge '5.008' ) {
utf8::downgrade($content, 1)
or Carp::croak(q/Wide character in request message body/);
}
$request->{headers}{'content-length'} = length $content
unless $request->{headers}{'content-length'}
sub write {
@_ == 2 || croak(q/Usage: $handle->write(buf)/);
my ($self, $buf) = @_;
if ( $] ge '5.008' ) {
utf8::downgrade($buf, 1)
or croak(q/Wide character in write()/);
}
my $len = length $buf;
my $data = $request->{cb}->();
defined $data && length $data
or last;
if ( $] ge '5.008' ) {
utf8::downgrade($data, 1)
or croak(q/Wide character in write_content()/);
}
$len += $self->write($data);
my $data = $request->{cb}->();
defined $data && length $data
or last;
if ( $] ge '5.008' ) {
utf8::downgrade($data, 1)
or croak(q/Wide character in write_chunked_body()/);
}
$len += length $data;
my $value = shift;
# may be a v-string
if ( length($value) >= 3 && $value !~ /[._]/
&& _is_non_alphanumeric($value)) {
my $tvalue;
if ( $] ge 5.008_001 ) {
$tvalue = _find_magic_vstring($value);
$value = $tvalue if length $tvalue;
}
elsif ( $] ge 5.006_000 ) {
$tvalue = sprintf("v%vd",$value);
if ( $tvalue =~ /^v\d+(\.\d+){2,}$/ ) {
# must be a v-string
$value = $tvalue;
}
view all matches for this distribution
view release on metacpan or search on metacpan
script/cpanurl view on Meta::CPAN
|| $request->{headers}{'transfer-encoding'};
$request->{cb} = $args->{content};
}
else {
my $content = $args->{content};
if ( $] ge '5.008' ) {
utf8::downgrade($content, 1)
or die(qq/Wide character in request message body\n/);
}
$request->{headers}{'content-length'} = length $content
unless $request->{headers}{'content-length'}
script/cpanurl view on Meta::CPAN
$escapes{' '}="+";
my $unsafe_char = qr/[^A-Za-z0-9\-\._~]/;
sub _uri_escape {
my ($self, $str) = @_;
if ( $] ge '5.008' ) {
utf8::encode($str);
}
else {
$str = pack("U*", unpack("C*", $str)) # UTF-8 encode a byte string
if ( length $str == do { use bytes; length $str } );
script/cpanurl view on Meta::CPAN
sub write {
@_ == 2 || die(q/Usage: $handle->write(buf)/ . "\n");
my ($self, $buf) = @_;
if ( $] ge '5.008' ) {
utf8::downgrade($buf, 1)
or die(qq/Wide character in write()\n/);
}
my $len = length $buf;
script/cpanurl view on Meta::CPAN
my $data = $request->{cb}->();
defined $data && length $data
or last;
if ( $] ge '5.008' ) {
utf8::downgrade($data, 1)
or die(qq/Wide character in write_content()\n/);
}
$len += $self->write($data);
script/cpanurl view on Meta::CPAN
my $data = $request->{cb}->();
defined $data && length $data
or last;
if ( $] ge '5.008' ) {
utf8::downgrade($data, 1)
or die(qq/Wide character in write_chunked_body()\n/);
}
$len += length $data;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/hopen/AppUtil.pm view on Meta::CPAN
all => [@EXPORT, @EXPORT_OK]
);
}
use Cwd qw(getcwd abs_path);
use File::Glob $] lt '5.016' ? ':glob' : ':bsd_glob';
# Thanks to haukex, https://www.perlmonks.org/?node_id=1207115 -
# 5.14 doesn't support the ':bsd_glob' tag.
use Path::Class;
# Docs {{{1
view all matches for this distribution
view release on metacpan or search on metacpan
mimi.fatpack view on Meta::CPAN
$fatpacked{"Test/Fatal.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'TEST_FATAL';
use strict;use warnings;package Test::Fatal;$Test::Fatal::VERSION='0.03';use Carp ();use Try::Tiny 0.07;use Exporter 5.57 'import';our@EXPORT=qw(exception);our@EXPORT_OK=qw(exception success dies_ok lives_ok);our ($REAL_TBL,$REAL_CALCULATED_TBL)=(1...
TEST_FATAL
$fatpacked{"Test/TempDir/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'TEST_TEMPDIR_TINY';
use 5.006002;use strict;use warnings;package Test::TempDir::Tiny;our$VERSION='0.03';use Exporter 5.57 qw/import/;our@EXPORT=qw/tempdir in_tempdir/;use Carp qw/confess/;use Cwd qw/abs_path/;use Errno qw/EEXIST ENOENT/;{no warnings 'numeric';use File...
TEST_TEMPDIR_TINY
$fatpacked{"Try/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'TRY_TINY';
package Try::Tiny;use 5.006;our$VERSION='0.03';use strict;use warnings;use Exporter 5.57 'import';our@EXPORT=our@EXPORT_OK=qw(try catch finally);use Carp;$Carp::Internal{+__PACKAGE__}++;BEGIN {my$su=$INC{'Sub/Util.pm'}&& defined&Sub::Util::set_subn...
TRY_TINY
view all matches for this distribution
view release on metacpan or search on metacpan
t/50perl-version-var.t view on Meta::CPAN
EOPERL
[],
'no diags from OK file' );
is( [ diags_from_treesitter( $check, <<'EOPERL' ) ],
my $ok = $] ge 5.036;
EOPERL
[ "lib/FILE.pm line 1 applies stringy comparison operator to '\$]'" ],
'diag from $] lhs of ge' );
is( [ diags_from_treesitter( $check, <<'EOPERL' ) ],
view all matches for this distribution
view release on metacpan or search on metacpan
sub all(&@) { my $prog = shift; &$prog || return for @_; 1 };
sub none(&@) { my $prog = shift; &$prog && return for @_; 1 };
sub notall(&@) { my $prog = shift; &$prog || return 1 for @_ };
sub product(@) { reduce { $a * $b } 1, @_ };
*sum0 = sub(@) { sum 0, @_ } if !defined \&sum0;
} if $] lt '5.02';
}
our( $A, @A,
@F, @FIELD,
view all matches for this distribution
view release on metacpan or search on metacpan
bin/plx-packed view on Meta::CPAN
)+)(.*)
$/xs or return ($file,undef,undef);if ($dist =~ /-undef\z/ and!length$version){$dist =~ s/-undef\z//}$version =~ s/-withoutworldwriteables$//;if ($version =~ /^(-[Vv].*)-(\d.*)/){$dist .= $1;$version=$2}if ($version =~ /(.+_.*)-(\d.*)/){$dist ....
CPAN_DISTNAMEINFO
$fatpacked{"CPAN/Meta.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'CPAN_META';
use 5.006;use strict;use warnings;package CPAN::Meta;our$VERSION='2.150005';use Carp qw(carp croak);use CPAN::Meta::Feature;use CPAN::Meta::Prereqs;use CPAN::Meta::Converter;use CPAN::Meta::Validator;use Parse::CPAN::Meta 1.4414 ();BEGIN {*_dclon...
CPAN_META
$fatpacked{"CPAN/Meta/Check.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'CPAN_META_CHECK';
package CPAN::Meta::Check;$CPAN::Meta::Check::VERSION='0.012';use strict;use warnings;use base 'Exporter';our@EXPORT=qw//;our@EXPORT_OK=qw/check_requirements requirements_for verify_dependencies/;our%EXPORT_TAGS=(all=>[@EXPORT,@EXPORT_OK ]);use C...
CPAN_META_CHECK
bin/plx-packed view on Meta::CPAN
$fatpacked{"File/pushd.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'FILE_PUSHD';
use strict;use warnings;package File::pushd;our$VERSION='1.009';our@EXPORT=qw(pushd tempd);our@ISA=qw(Exporter);use Exporter;use Carp;use Cwd qw(getcwd abs_path);use File::Path qw(rmtree);use File::Temp qw();use File::Spec;use overload q{""}=>sub...
FILE_PUSHD
$fatpacked{"HTTP/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'HTTP_TINY';
package HTTP::Tiny;use strict;use warnings;our$VERSION='0.056';use Carp ();my@attributes;BEGIN {@attributes=qw(cookie_jar default_headers http_proxy https_proxy keep_alive local_address max_redirect max_size proxy no_proxy timeout SSL_options ver...
sub $sub_name {
my (\$self, \$url, \$args) = \@_;
\@_ == 2 || (\@_ == 3 && ref \$args eq 'HASH')
or Carp::croak(q/Usage: \$http->$sub_name(URL, [HASHREF])/ . "\n");
return \$self->request('$req_method', \$url, \$args || {});
view all matches for this distribution
view release on metacpan or search on metacpan
inc/My/Module/Recommend.pm view on Meta::CPAN
use My::Module::Recommend::Any qw{ __any };
use My::Module::Recommend::All qw{ __all };
my ( $is_5_010, $is_5_012 );
if ( $] ge '5.012' ) {
$is_5_012 = $is_5_010 = 1;
} elsif ( $] ge '5.010' ) {
$is_5_010 = 1;
};
my %misbehaving_os = map { $_ => 1 } qw{ MSWin32 cygwin };
view all matches for this distribution
view release on metacpan or search on metacpan
inc/My/Module/Recommend.pm view on Meta::CPAN
use My::Module::Recommend::Any qw{ __any };
my ( $is_5_010, $is_5_012 );
if ( $] ge '5.012' ) {
$is_5_012 = $is_5_010 = 1;
} elsif ( $] ge '5.010' ) {
$is_5_010 = 1;
};
my %misbehaving_os = map { $_ => 1 } qw{ MSWin32 cygwin };
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/Coord/ECI/Utils.pm view on Meta::CPAN
sub __sprintf {
my ( $tplt, @args ) = @_;
defined $tplt
or return undef; ## no critic (ProhibitExplicitReturnUndef)
no if $] gt '5.021002', qw{ warnings redundant };
return sprintf $tplt, @args;
}
{
my %deprecate = (
view all matches for this distribution
view release on metacpan or search on metacpan
inc/BSONConfig.pm view on Meta::CPAN
# check for big-endian
my $endianess = $Config{byteorder};
if ( $endianess == 4321 || $endianess == 87654321 ) {
$ccflags .= " -DMONGO_BIG_ENDIAN=1 ";
if ( $] lt '5.010' ) {
die "OS unsupported: Perl 5.10 or greater is required for big-endian platforms";
}
}
# needed to compile bson library
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BSON.pm view on Meta::CPAN
#pod be generated. If not set, the default value is taken from the
#pod C<BSON_EXTJSON_RELAXED> environment variable.
#pod
#pod =cut
my $use_win32_specials = ($^O eq 'MSWin32' && $] lt "5.022");
my $is_inf = $use_win32_specials ? qr/^1.\#INF/i : qr/^inf/i;
my $is_ninf = $use_win32_specials ? qr/^-1.\#INF/i : qr/^-inf/i;
my $is_nan = $use_win32_specials ? qr/^-?1.\#(?:IND|QNAN)/i : qr/^-?nan/i;
lib/BSON.pm view on Meta::CPAN
}
# Following extended JSON is non-standard
if ( exists $data->{'$numberDouble'} ) {
if ( $data->{'$numberDouble'} eq '-0' && $] lt '5.014' && ! HAS_LD ) {
$data->{'$numberDouble'} = '-0.0';
}
return BSON::Double->new( value => $data->{'$numberDouble'} );
}
lib/BSON.pm view on Meta::CPAN
}
# Following extended JSON is non-standard
if ( exists $hash->{'$numberDouble'} ) {
if ( $hash->{'$numberDouble'} eq '-0' && $] lt '5.014' && ! HAS_LD ) {
$hash->{'$numberDouble'} = '-0.0';
}
return BSON::Double->new( value => $hash->{'$numberDouble'} );
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/badge-simple.t view on Meta::CPAN
my $got = badge( left=>'foo', right=>'bar', color=>'#e542f4', font=>$fontfile );
is_svg_similar $got, $exp, 'foo.svg';
}
subtest 'CLI' => sub {
plan $] ge '5.008' ? ( tests=>2 ) : ( skip_all=>'bin/badge requires perl 5.008' );
my ($tfh, $outfile) = tempfile(UNLINK=>1);
close $tfh;
my $script = catfile($FindBin::Bin, updir, 'bin', 'badge');
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-basics.t view on Meta::CPAN
ok(!defined($res));
ok($?);
diag "Executing `$rand`";
$res = `$rand`;
if ($] lt "5.020") {
# in perl < v5.20, res is an empty string [CT]
ok(!defined($res) || $res eq '') or diag "res=", explain($res);
} else {
ok(!defined($res)) or diag "res=", explain($res);
ok($?);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/OnlinePayment/Litle.pm view on Meta::CPAN
## END XML Generation
$self->server_request( $post_data );
warn $self->server_request if $DEBUG;
if ( $] ge '5.008' ) {
# http_post expects data in this format
utf8::encode($post_data) if utf8::is_utf8($post_data);
}
my ( $page, $status_code, %headers ) = $self->https_post( { 'Content-Type' => 'text/xml; charset=utf-8' } , $post_data);
view all matches for this distribution
view release on metacpan or search on metacpan
xt/06-meta-yaml.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
if( $] lt '5.018000' ) {
plan skip_all => 'YAML test not avaiable pre-5.18';
exit(0);
}
if( ! $ENV{RELEASE_TESTING} ) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/06-meta-yaml.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
if( $] lt '5.018000' ) {
plan skip_all =>
'YAML test not avaiable pre-5.18';
exit(0);
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/from-hash.t view on Meta::CPAN
);
}
SKIP: {
skip "Can't tell v-strings from strings until 5.8.1", 1
unless $] gt '5.008';
my $string_hash = {
Left => 10,
Shared => '= 2',
Right => 18,
};
t/from-hash.t view on Meta::CPAN
);
}
SKIP: {
skip "Can't tell v-strings from strings until 5.8.1", 2
unless $] gt '5.008';
my $string_hash = {
Left => 10,
Shared => v50.44.60,
Right => 18,
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CPAN/Meta.pm view on Meta::CPAN
sub save {
my ($self, $file, $options) = @_;
my $version = $options->{version} || '2';
my $layer = $] ge '5.008001' ? ':utf8' : '';
if ( $version ge '2' ) {
carp "'$file' should end in '.json'"
unless $file =~ m{\.json$};
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
$request->{cb} = $args->{content};
}
}
elsif ( length $args->{content} ) {
my $content = $args->{content};
if ( $] ge '5.008' ) {
utf8::downgrade($content, 1)
or die(qq/Wide character in request message body\n/);
}
$request->{headers}{'content-type'} ||= "application/octet-stream";
$request->{headers}{'content-length'} = length $content
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
my $unsafe_char = qr/[^A-Za-z0-9\-\._~]/;
sub _uri_escape {
my ($self, $str) = @_;
return "" if !defined $str;
if ( $] ge '5.008' ) {
utf8::encode($str);
}
else {
$str = pack("U*", unpack("C*", $str)) # UTF-8 encode a byte string
if ( length $str == do { use bytes; length $str } );
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
sub write {
@_ == 2 || die(q/Usage: $handle->write(buf)/ . "\n");
my ($self, $buf) = @_;
if ( $] ge '5.008' ) {
utf8::downgrade($buf, 1)
or die(qq/Wide character in write()\n/);
}
my $len = length $buf;
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
my $data = $request->{cb}->();
defined $data && length $data
or last;
if ( $] ge '5.008' ) {
utf8::downgrade($data, 1)
or die(qq/Wide character in write_content()\n/);
}
$len += $self->write($data);
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
my $data = $request->{cb}->();
defined $data && length $data
or last;
if ( $] ge '5.008' ) {
utf8::downgrade($data, 1)
or die(qq/Wide character in write_chunked_body()\n/);
}
$len += length $data;
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Cases.pm view on Meta::CPAN
#--------------------------------------------------------------------------#
my %texts = (
short => 'Hello World',
multiline => 'First line\nSecond line\n',
( $] lt "5.008" ? () : ( unicode => 'Hi! \x{263a}\n') ),
);
#--------------------------------------------------------------------------#
# fcn($perl_code_string) => execute the perl in current process or subprocess
#--------------------------------------------------------------------------#
view all matches for this distribution