view release on metacpan or search on metacpan
lib/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
lib/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 } );
lib/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;
lib/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);
lib/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
lib/Hash/Ordered.pm view on Meta::CPAN
_TOMBSTONE => \1, # ref to arbitrary scalar
};
# 'overloading.pm' not available until 5.10.1 so emulate with Scalar::Util
BEGIN {
if ( $] gt '5.010000' ) {
## no critic
eval q{
sub _stringify { no overloading; "$_[0]" }
sub _numify { no overloading; 0+$_[0] }
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Hash/Wrap.pm view on Meta::CPAN
meta => [ map { ( qq[q($_) => q($attr->{$_}),] ) } keys %$attr ],
predicate_template => q{},
);
if ( $attr->{-lvalue} ) {
if ( $] lt '5.016000' ) {
_croak( 'lvalue accessors require Perl 5.16 or later' )
if $attr->{-lvalue} < 0;
}
else {
$dict{autoload_attr} = q[: lvalue];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HealthCheck/Diagnostic/SMTP.pm view on Meta::CPAN
use parent 'HealthCheck::Diagnostic';
use Net::SMTP;
# https://metacpan.org/pod/distribution/perl/pod/perl5140delta.pod#Exception-Handling
use constant UNSTABLE_DOLLARAT => $] lt '5.013002';
# ABSTRACT: Verify connectivity to an SMTP mail server
use version;
our $VERSION = 'v0.0.4'; # VERSION
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Hydrogen.pm view on Meta::CPAN
require Carp;
@_ = $message;
goto \&Carp::croak;
}
if ( $] ge '5.016' ) {
*fc = \&CORE::GLOBAL::fc;
}
else {
eval 'sub fc { lc( @_ ? $_[0] : $_ ) }';
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/IPC/ConcurrencyLimit/Lock/Redis.pm view on Meta::CPAN
# This is so ugly because we compile slightly different code depending on whether
# we're running on a perl that can do big-endian-forced-quads or not.
# FIXME Will work on 64bit perls only. Implementation for 32bit integers welcome.
# FIXME is this worth it or should it just do a run-time perl version check like heartbeat()?
eval(<<'PRE' . ($] ge '5.010' ? <<'NEW_PERL' : <<'OLD_PERL') . <<'POST')
sub clear_old_locks {
my ($class, $redis_conn, $key_name, $cutoff) = @_;
my %hash = $redis_conn->hgetall($key_name);
return if not keys(%hash);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/IPC/Run3/Shell/CLIWrapper.pm view on Meta::CPAN
if ( ref $x eq 'ARRAY' ) {
if ( @$x%2 ) {
# ... work around a Carp issue in really old Perls ...
# uncoverable branch true
# uncoverable condition true
if ( $] lt '5.008' ) {
warn "Odd number of elements in argument list"; # uncoverable statement
} else { warnings::warnif('IPC::Run3::Shell',
'Odd number of elements in argument list') }
}
for (my $i=0;$i<@$x;$i+=2) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/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
lib/Installer/cpanm.pm 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 {*_dclone=...
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 CPA...
CPAN_META_CHECK
lib/Installer/cpanm.pm 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 verif...
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
lib/Language/FormulaEngine/Namespace.pm view on Meta::CPAN
package Language::FormulaEngine::Namespace;
use Moo;
use Carp;
use Try::Tiny;
require MRO::Compat if $] lt '5.009005';
use Language::FormulaEngine::Error ':all';
use namespace::clean;
# ABSTRACT: Object holding function and variable names
our $VERSION = '0.08'; # VERSION
view all matches for this distribution
view release on metacpan or search on metacpan
builder/MyBuilder.pm view on Meta::CPAN
sub new {
my ($self, %args) = @_;
# SEE ALSO: https://metacpan.org/pod/release/RENEEB/perl-5.27.9/pod/perldelta.pod#New-read-only-predefined-variable-${^SAFE_LOCALES}
if ($] ge '5.027009' && !${^SAFE_LOCALES}) {
die "This module is unsafe if the perl dosen't support safe locales.\n";
}
return $self->SUPER::new(%args);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MCE/Hobo.pm view on Meta::CPAN
my @args = @_; @_ = (); # To avoid (Scalars leaked: N) messages
my ( $killed, $pid );
{
local $SIG{TERM} = local $SIG{INT} = sub { $killed = $_[0] }
if ( !$_is_MSWin32 && $] ge '5.010001' );
local $SIG{TTIN}, local $SIG{TTOU}, local $SIG{WINCH}
if ( !$_is_MSWin32 );
$pid = fork();
view all matches for this distribution
view release on metacpan or search on metacpan
$_has_threads = $INC{'threads.pm'} ? 1 : 0;
$_tid = $_has_threads ? threads->tid() : 0;
$_oid = "$$.$_tid";
if ( $] ge '5.008008' && ! $INC{'PDL.pm'} ) {
eval 'use Sereal::Encoder 3.015; use Sereal::Decoder 3.015;';
if ( ! $@ ) {
my $_encoder_ver = int( Sereal::Encoder->VERSION() );
my $_decoder_ver = int( Sereal::Decoder->VERSION() );
if ( $_encoder_ver - $_decoder_ver == 0 ) {
{
my $_wid = $_args[1];
my $_seed = abs($self->{_seed} - ($_wid * 100000)) % 2147483560;
CORE::srand($_seed) if (!$self->{use_threads} || $] ge '5.020000'); # drand48
Math::Prime::Util::srand($_seed) if $INC{'Math/Prime/Util.pm'};
# [etj] identified a race condition in PDL running threads
# https://perlmonks.org/?node_id=11159841
if (!$self->{use_threads}) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Macro/Simple.pm view on Meta::CPAN
our $VERSION = '0.003';
use Carp;
use constant DO_MACRO => (
$] ge 5.014000 and
require Parse::Keyword and
require PPI and
require Sub::Boolean
);
view all matches for this distribution
view release on metacpan or search on metacpan
t/assignPVl.t view on Meta::CPAN
}
assignPVl($d128, ' -0.162.235');
# Allow for known brokenness of 5.21.x (for x < 9) builds of perl.
if($] lt '5.021009' && $] ge '5.021001') {set_nnuml(8)}
if("$d128" eq '-162e-3' && nnumflagl() == 8) {print "ok 72\n"}
else {
warn "\nExpected -162e-3\nGot $d128\n";
warn "nnumflagl expected 8, got ", nnumflagl(), "\n";
view all matches for this distribution
view release on metacpan or search on metacpan
t/assignPV.t view on Meta::CPAN
}
assignPV($d64, ' -0.162.235');
# Allow for known brokenness of 5.21.x (for x < 9) builds of perl.
if($] lt '5.021009' && $] ge '5.021001') {set_nnum(10)}
if("$d64" eq '-162e-3' && nnumflag() == 10) {print "ok 72\n"}
else {
warn "\nExpected -162e-3\nGot $d64\n";
warn "nnumflag expected 10, got ", nnumflag(), "\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Metabase/Fact/String.pm view on Meta::CPAN
}
sub content_as_bytes {
my ($self) = @_;
my $bytes = $self->content;
utf8::encode($bytes) if $] ge '5.008'; # converts in-place
return $bytes;
}
sub content_from_bytes {
my ( $class, $bytes ) = @_;
utf8::decode($bytes) if $] ge '5.008'; # converts in-place
return $bytes;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mic/Assembler.pm view on Meta::CPAN
if ( ! $spec->{implementation}{methods}{ $meta->{property} }
&& $meta->{property}
&& $in_interface->{ $meta->{property} } ) {
confess "'property' can only be used from Perl 5.16 onwards"
if $] lt '5.016';
$spec->{implementation}{methods}{ $meta->{property} } = sub : lvalue {
my ($self) = @_;
return $self->[ $spec->{implementation}{slot_offset}{$name} ];
};
view all matches for this distribution
view release on metacpan or search on metacpan
t/11-charset.t view on Meta::CPAN
}
};
subtest charset_invlist => sub {
# Perl added vertical-tab to \s in 5.12
my @space_ascii= ( 9,( $] lt '5.012'? (11,12):() ),14, 32,33 );
my @tests= (
[ 'A-Z', 0x7F,
[ 65,91 ]
],
[ 'A-Z', undef,
t/11-charset.t view on Meta::CPAN
[ 65,91, 97,123 ]
],
[ '\w', 0x7F,
[ 48,58, 65,91, 95,96, 97,123 ]
],
($] ge '5.026'? ( # the definition of \w and \s varies over perl versions
[ '\w', 0x200,
[ 48,58, 65,91, 95,96, 97,123, 170,171, 181,182, 186,187, 192,215, 216,247, 248,0x201 ],
],
[ '\s', 0x7F,
[ @space_ascii ],
],
[ '\s', undef,
[ @space_ascii, 133,134, 160,161, 5760,5761,
($] lt '5.012'? (6158,6159) : ()),
8192,8203, 8232,8234, 8239,8240, 8287,8288, 12288,12289 ],
],
):()),
[ '\p{Block: Katakana}', undef,
[ 0x30A0, 0x3100 ],
],
[ '^[:digit:]', 0x7F,
[ 0,0x30, 0x3A,0x80 ],
],
($] ge '5.012'? ( # \p{digit} wasn't available until 5.12
[ '[:alpha:]\P{digit}', 0x7F,
[ 0,0x30, 0x3A,0x80 ],
],
):()),
[ '\p{alpha}\P{alpha}', undef,
t/11-charset.t view on Meta::CPAN
is( [ $charset->find_member("G") ], [ undef, 6 ], 'G would insert at position 6' );
};
subtest lazy_attributes => sub {
skip_all "\\P{digit} not supported on 5.10"
if $] lt '5.012';
my $charset= charset('[:alpha:]\P{digit}');
ok( !$charset->find_member('0'), '"0" not in the set of alpha and non-digit' );
is( scalar $charset->find_member('a'), 87, 'member "a" found at 87' );
ok( defined $charset->{member_invlist} && defined $charset->{_invlist_index}, 'used invlist' );
ok( !defined $charset->{members}, 'did not use members[]' );
view all matches for this distribution
view release on metacpan or search on metacpan
inc/MBVersion.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
lib/MongoDB/_Constants.pm view on Meta::CPAN
MIN_SERVER_VERSION => "2.4.0",
MIN_WIRE_VERSION => 0,
RESCAN_SRV_FREQUENCY_SEC => $ENV{TEST_MONGO_RESCAN_SRV_FREQUENCY_SEC} || 60,
NO_JOURNAL_RE => qr/^journaling not enabled/,
NO_REPLICATION_RE => qr/^no replication has been enabled/,
P_INT32 => $] lt '5.010' ? 'l' : 'l<',
SMALLEST_MAX_STALENESS_SEC => 90,
WITH_ASSERTS => $ENV{PERL_MONGO_WITH_ASSERTS},
# Transaction state tracking
TXN_NONE => 'none',
TXN_STARTING => 'starting',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MooX/Press.pm view on Meta::CPAN
use Module::Runtime qw(use_module);
use namespace::autoclean;
sub make_absolute_package_name {
my $p = shift;
$] lt '5.018' ? "main::$p" : "::$p";
}
if ( $] lt '5.010' ) {
require UNIVERSAL::DOES;
}
# Options not to carry up into subclasses;
# mostly because subclasses inherit behaviour anyway.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MooseX/Extended/Core.pm view on Meta::CPAN
{
my $call_level = 1 + $opt_for{_call_level};
my ( undef, $filename, $line ) = caller($call_level);
Carp::carp("$attr_type '$name' is read-only and has no init_arg or default, defined at $filename line $line\n")
if $] ge '5.028'
and warnings::enabled_at_level( 'MooseX::Extended::naked_fields', $call_level );
}
delete $opt_for{_call_level};
_debug( "Setting $attr_type, '$orig_name'", \%opt_for );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mutex/Channel.pm view on Meta::CPAN
use Mutex::Util;
use Scalar::Util 'looks_like_number';
use Time::HiRes 'alarm';
my $is_MSWin32 = ($^O eq 'MSWin32') ? 1 : 0;
my $use_pipe = ($^O !~ /mswin|mingw|msys|cygwin/i && $] gt '5.010000');
my $tid = $INC{'threads.pm'} ? threads->tid : 0;
sub CLONE {
$tid = threads->tid if $INC{'threads.pm'};
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-load.t view on Meta::CPAN
#!/usr/bin/env perl
use Test::More tests => 4;
BEGIN {
if ($] ge '5.026') {
use lib '.';
}
use_ok('Net::IPAddress::Util');
use_ok('Net::IPAddress::Util::Range');
use_ok('Net::IPAddress::Util::Collection');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/Telnet.pm view on Meta::CPAN
last;
}');
## Code template used to build pattern match conditional.
## Values between array elements must be supplied later.
if ($] ge '5.006') { # perl5.6.0+ has performance alternative to $` and $&
@match_cond =
('if ($s->{buf} =~ ', ') {
$prematch = substr($s->{buf}, 0, $-[0]);
$match = substr($s->{buf}, $-[0], $+[0] - $-[0]);
substr($s->{buf}, 0, length($prematch) + length($match)) = "";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Object/HashBase/Test.pm view on Meta::CPAN
local $SIG{__WARN__} = sub { };
*Object::HashBase::Test::Const::Test::FOO = sub { 0 };
}
ok(!$pkg->FOO, "overrode const sub");
{
local $TODO = "known to fail on $]" if $] le "5.006002";
is($pkg->do_it, 'const', "worked as expected, const was constant");
}
BEGIN {
$INC{'Object/HashBase/Test/HBase/Wrapped.pm'} = __FILE__;
view all matches for this distribution
view release on metacpan or search on metacpan
t/01method.t view on Meta::CPAN
'anon method' );
}
# nested anon method (RT132321)
SKIP: {
skip "This causes SEGV on perl 5.16 (RT132321)", 1 if $] lt "5.018";
class RT132321 {
field $_genvalue;
BUILD {
$_genvalue = method { 123 };
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