view release on metacpan or search on metacpan
t/truncate_cer.t view on Meta::CPAN
#--------------------------------------------------------------------
# Entity in input text â should not be split
#--------------------------------------------------------------------
{
name => 'entity in input text not split mid-reference',
input => 'AB&CDEFGHIJ',
tmpl => '[% text | truncate(5, "...") %]',
# visual: A B & C D E F G H I J = 11 visual chars
# truncate to 5 visual: 2 text + "..." = 5? No: 5 - 3 = 2 visual chars of text
# visual chars: A, B â "AB..."
view all matches for this distribution
view release on metacpan or search on metacpan
t/60_hashed_color.t view on Meta::CPAN
$in .= "test: test$_\n" for 1 .. $tests;
$in .= "test: test3 test4 test1 test2\n";
run \@cmd, \$in, \my $out, sub { die "@_" };
my @lines = split m/\s*[\x0d\x0a]\s*/, $out;
my @t;
for( 1 .. $tests ) {
my $t = shift @lines;
$t =~ s/.*test:\S*\s//;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Term/Sk.pm view on Meta::CPAN
my $ctr4 = Term::Sk->new($format, {base => 1234567, target => 2345678, num => q{9}});
# The following numbers are shown: act 1234567 max 2345678
my $ctr5 = Term::Sk->new($format, {base => 1234567, target => 2345678,
commify => sub{ join '!', split m{}xms, $_[0]; }});
# The following numbers are shown: act 1!2!3!4!5!6!7 max 2!3!4!5!6!7!8
=head1 DESCRIPTION
=head2 Format strings
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/CVE.pm view on Meta::CPAN
$mfc or return $self;
my ($pv, $release, $nm, $v, $vf) = ("");
foreach my $mfx (grep { m/=>/ }
map { split m/\s*[;(){}]\s*/ }
map { split m/\s*,(?!\s*=>)/ }
split m/[,;]\s*(?:#.*)?\r*\n/ => $mfc) {
$mfx =~ s/[\s\r\n]+/ /g;
$mfx =~ s/^\s+//;
$mfx =~ s/^(['"])(.*?)\1/$2/; # Unquote key
my $a = qr{\s* (?:,\s*)? => \s* (?|"([^""]*)"|'([^'']*)'|([-\w.]+))}x;
$mfx =~ m/^ VERSION $a /ix and $v //= $1;
view all matches for this distribution
view release on metacpan or search on metacpan
countit ../perl/lib/Benchmark.pm /^sub countit {$/;" s class:Benchmark
cp ../perl/lib/File/Copy.pm /^sub cp {$/;" s class:Copy
cp ../perl/lib/File/Copy.pm /^sub cp;$/;" s class:Copy
cp ../perl/lib/Unicode/UCD.pm /^ my $cp;$/;" v file: class:UCD
cp ../perl/lib/Unicode/UCD.pm /^ my ($cp, $n) = ($codepoints->[$i], $names->[$i]);$/;" v file: class:UCD
cp ../perl/lib/Unicode/UCD.pm /^ my ($cp, $name) = split m\/\\t\/ => $_;$/;" v file: class:UCD
cp ../perl/lib/Unicode/UCD.pm /^ my $cp = _getcode($input_cp);$/;" v file: class:UCD
cp ../perl/lib/Unicode/UCD.pm /^ my $cp = _getcode($input_cp);$/;" v file: class:UCD
cp ../perl/lib/Unicode/UCD.pm /^ my (%name, %cp);$/;" v file: class:UCD
cp ../perl/lib/Unicode/UCD.pm /^ my (%name, %cp, %cps, $n);$/;" v file: class:UCD
cpan ../Catalyst-Controller-HTML-FormFu/lib/Catalyst/Helper/HTML/FormFu.pm /^Carl Franks, C<cfranks@cpan.org>$/;" v file: class:FormFu
name ../perl/lib/ExtUtils/XSSymSet.pm /^ my($self,$name,$maxlen,$silent) = @_;$/;" v file: class:XSSymSet
name ../perl/lib/Symbol.pm /^ my $name = "GEN" . $genseq++;$/;" v file: class:Symbol
name ../perl/lib/Symbol.pm /^ my ($name) = @_;$/;" v file: class:Symbol
name ../perl/lib/Unicode/UCD.pm /^ my ($sequence, $name) = split \/\\t\/;$/;" v file: class:UCD
name ../perl/lib/Unicode/UCD.pm /^ my ($hex_code_point, $name) = split "\\t", $line;$/;" v file: class:UCD
name ../perl/lib/Unicode/UCD.pm /^ my ($cp, $name) = split m\/\\t\/ => $_;$/;" v file: class:UCD
name ../perl/lib/Unicode/UCD.pm /^ my (%name, %cp);$/;" v file: class:UCD
name ../perl/lib/Unicode/UCD.pm /^ my (%name, %cp, %cps, $n);$/;" v file: class:UCD
name ../perl/lib/_charnames.pm /^ my ($name, $utf8) = @_;$/;" v file: class:_charnames
name ../perl/lib/_charnames.pm /^ my ($name, $wants_ord, $runtime) = @_;$/;" v file: class:_charnames
name ../perl/lib/feature.pm /^ my $name = shift;$/;" v file: class:feature
proto ../dbix-class/lib/DBIx/Class/CDBICompat/ReadOnly.pm /^ my $proto = shift;$/;" v file:
proto ../perl/lib/B/Deparse.pm /^ my $proto = $cv->PV;$/;" v file: class:Deparse
proto ../perl/lib/B/Deparse.pm /^ my $proto = prototype("CORE::$name");$/;" v file: class:Deparse
proto ../perl/lib/B/Deparse.pm /^ my $proto = undef;$/;" v file: class:Deparse
proto ../perl/lib/B/Deparse.pm /^ my($proto, @args) = @_;$/;" v file: class:Deparse
proto ../perl/lib/Net/servent.pm /^ my ($service, $proto) = ((split m!\/!, shift), 'tcp');$/;" v file: class:servent
proto_bind ../dbix-class/lib/DBIx/Class/Storage/DBI.pm /^ $self->_dbh_execute_for_fetch( $source, $sth, $proto_bind, $cols, $data );$/;" v file: class:DBI
proto_bind ../dbix-class/lib/DBIx/Class/Storage/DBI.pm /^ if (@$proto_bind) {$/;" v file: class:DBI
proto_bind ../dbix-class/lib/DBIx/Class/Storage/DBI.pm /^ my ($self, $source, $sth, $proto_bind, $cols, $data) = @_;$/;" v file: class:DBI
proto_bind ../dbix-class/lib/DBIx/Class/Storage/DBI.pm /^ my ($sql, $proto_bind) = $self->_prep_for_execute ($/;" v file: class:DBI
proto_bind ../dbix-class/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm /^ my $proto_bind = $self->_resolve_bindattrs($/;" v file: class:ASE
server ../Catalyst-Runtime/lib/Catalyst/Test.pm /^ my $server = URI->new($ENV{CATALYST_SERVER});$/;" v file: class:Test
server_close ../Starman/lib/Starman/Server.pm /^sub server_close {$/;" s class:Server
server_version ../dbix-class/lib/DBIx/Class/Storage/DBI.pm /^ my $server_version = dbic_internal_try {$/;" v file: class:DBI
service ../Tak/lib/Tak/Router.pm /^ my ($self, $name, $service) = @_;$/;" v file: class:Router
service ../Tak/lib/Tak/Router.pm /^ my ($self, $name, $service) = @_;$/;" v file: class:Router
service ../perl/lib/Net/servent.pm /^ my ($service, $proto) = ((split m!\/!, shift), 'tcp');$/;" v file: class:servent
set ../HTML-FormFu/lib/HTML/FormFu/Constraint/AutoSet.pm /^ my @set = map { _parse_value($_) } @{ $self->parent->_options };$/;" v file: class:AutoSet
set ../HTML-FormFu/lib/HTML/FormFu/Constraint/Set.pm /^ my $set = $self->set;$/;" v file: class:Set
set ../HTML-FormFu/lib/HTML/FormFu/Constraint/Set.pm /^ my %set = map { $_ => 1 } @$set;$/;" v file: class:Set
set ../dbix-class/lib/DBIx/Class/Admin.pm /^ my ($self, $rs, $set) = @_;$/;" v file: class:Admin
set ../dbix-class/lib/DBIx/Class/Admin.pm /^ my ($self, $rs, $set, $where) = @_;$/;" v file: class:Admin
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/File/Contents.pm view on Meta::CPAN
# See https://rt.perl.org/Ticket/Display.html?id=127668 for details.
return join '', <$fh>;
}
sub _resolve {
$_[0] =~ m{/} ? File::Spec->catfile(split m{/}, shift) : shift;
}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/File.pm view on Meta::CPAN
sub _normalize {
my $file = shift;
return unless defined $file;
return $file =~ m|/|
? File::Spec->catfile( split m|/|, $file )
: $file;
}
sub _win32 {
return 0 if $^O eq 'darwin';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/HTTP/AnyEvent/Server.pm view on Meta::CPAN
my $len = sysread $rh, $buf, 65536;
AE::log fatal =>
"couldn't sysread() from pipe: $!"
if not defined $len or not $len;
my ($address, $port) = split m{\t}x, $buf;
$self->set_address($address);
$self->set_port($port);
$self->set_forked_pid($pid);
AE::log info =>
"forked as $pid and bound to " . $self->uri;
lib/Test/HTTP/AnyEvent/Server.pm view on Meta::CPAN
sub _start {
my ($self, $my_handle) = @_;
return $my_handle->push_read(regex => qr{(\015?\012){2}}x, sub {
my ($h, $data) = @_;
my ($req, $hdr) = split m{\015?\012}x, $data, 2;
$req =~ s/\s+$//sx;
AE::log debug => "request: [$req]\n";
if ($hdr =~ m{\bContent-length:\s*(\d+)\b}isx) {
AE::log debug => "expecting content\n";
$h->push_read(chunk => int($1), sub {
lib/Test/HTTP/AnyEvent/Server.pm view on Meta::CPAN
$method,
$uri,
[
map {
m{^\s*([^:\s]+)\s*:\s*(.*)$}sx
} split m{\015?\012}x, $hdr
],
$content,
));
$found = eval { $self->custom_handler->($res) };
if ($@) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/HTTP/Server.pm view on Meta::CPAN
date => $self->_http_time,
);
$self->{out_headers} = { %default_headers };
my $raw_uri = $self->{request}->[1];
my @req_parts = split m#\?#, $raw_uri;
my $req = shift @req_parts;
$req =~ s#^/+##;
my @args = map { uri_unescape $_ } split m#/#, $req;
my $func = shift @args;
$func = "index" unless defined $func and length $func;
my $body;
eval {
view all matches for this distribution
view release on metacpan or search on metacpan
# repair last line without \n
ok(
! ( $text =~ s{([^\x0D\x0A]) \z}{$1\x0D\x0A}xms ),
"$file_name has newline at EOF",
);
@lines = split m{\x0A}, $text;
}
my $find_line_numbers = sub {
my ($test_description, $test_reason, $regex, $regex_negation) = @_;
my $line_number = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/Lazy/Template.pm view on Meta::CPAN
sub new {
my $self = bless {}, shift;
my $tester = blessed $_[0] && $_[0]->isa("Test::Lazy::Tester") ? shift : Test::Lazy::Tester->new;
my $template = $_[0];
if (ref $template eq 'SCALAR') {
my @template = map { [ $_ ] } grep { length $_ && $_ !~ m/^\s*#/ } split m/\n/, $$template;
$template = \@template;
}
elsif (ref $template eq 'ARRAY') {
}
else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/Metrics/Any.pm view on Meta::CPAN
sub is_metrics
{
my ( $expect, $testname ) = @_;
my $tb = __PACKAGE__->builder;
my %got = map { ( split m/\s*=\s*/, $_ )[0,1] } split m/\n/, Metrics::Any::Adapter::Test->metrics;
foreach my $name ( sort keys %$expect ) {
my $expectval = $expect->{$name};
my $gotval = $got{$name};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/MockFile.pm view on Meta::CPAN
$path = Cwd::getcwd() . "/$path";
}
# Resolve path components: remove ".", resolve "..", collapse slashes
my @resolved;
for my $part ( split m{/}, $path ) {
next if $part eq '' || $part eq '.';
if ( $part eq '..' ) {
pop @resolved;
next;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/Mojibake.pm view on Meta::CPAN
} elsif ($line =~ /^=+\w+/x) {
$pod = 1;
} elsif ($pod == 0) {
# source
$line =~ s/^\s*\#.*$//sx; # disclaimers placed in headers frequently contain UTF-8 *before* its usage is declared.
foreach (split m{;}x, $line) {
# trim
s/^\s+|\s+$//gsx;
my @type = qw(0 0 0);
++$type[_detect_utf8(\$_)];
view all matches for this distribution
view release on metacpan or search on metacpan
Revision history for Test::Needs
0.002010 - 2023-01-22
- split main test into three separate scripts
- avoid outputting multiple plans if used with no_plan
0.002009 - 2021-05-25
- fix warnings from Test::Builder if Test::Needs is loaded first, and is
used to check for a Test module.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
@{ $self->rscan_dir($dir, file_qr("\\.$type\$")) } };
}
sub localize_file_path {
my ($self, $path) = @_;
return File::Spec->catfile( split m{/}, $path );
}
sub localize_dir_path {
my ($self, $path) = @_;
return File::Spec->catdir( split m{/}, $path );
}
sub fix_shebang_line { # Adapted from fixin() in ExtUtils::MM_Unix 1.35
my ($self, @files) = @_;
my $c = ref($self) ? $self->{config} : 'Module::Build::Config';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/Reporter/Transport/Socket.pm view on Meta::CPAN
my $build = { %empty_build };
$pv =~ m{^\s+Compiled at\s+(.*)}m
and $build->{'stamp'} = $1;
$pv =~ m{^\s+Locally applied patches:(?:\s+|\n)(.*?)(?:[\s\n]+Buil[td] under)}ms
and $build->{'patches'} = [ split m{\n+\s*}, $1 ];
$pv =~ m{^\s+Compile-time options:(?:\s+|\n)(.*?)(?:[\s\n]+(?:Locally applied|Buil[td] under))}ms
and map { $build->{'options'}{$_} = 1 } split m{\s+|\n} => $1;
$build->{'osname'} = $config{'osname'};
$pv =~ m{^\s+Built under\s+(.*)}m
and $build->{'osname'} = $1;
$config{'osname'} ||= $build->{'osname'};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/Smoke/BuildCFG.pm view on Meta::CPAN
my $self = shift;
return unless defined $self->{_buildcfg}; # || $self->{_list};
$self->{_sections} = [ ];
my @sections = split m/^=.*\n/m, $self->{_buildcfg};
$self->log_debug("Found %d raw-sections", scalar @sections);
foreach my $section ( @sections ) {
chomp $section;
my $index = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/Unit/Lite.pm view on Meta::CPAN
my $src = __FILE__;
my $dst = "inc/Test/Unit/Lite.pm";
my @src = split m{/}, $src;
my @dst = split m{/}, $dst;
my $srcfile = File::Spec->catfile(@src);
my $dstfile = File::Spec->catfile(@dst);
die "Cannot bundle to itself: $srcfile\n" if $srcfile eq $dstfile;
print "Copying $srcfile -> $dstfile\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/Virtual/Filesystem.pm view on Meta::CPAN
my ($class, $symbol, $code_ref, $attr, $features) = @_;
if ($symbol eq 'ANON') {
warn 'cannot test anonymous subs - you probably loaded ' . $class . ' too late.' .
' (after the CHECK block was run)';
} else {
my @features = ref $features ? @{$features} : split m/\s*,\s*/xms, $features;
# Wrap the sub in a feature test
no warnings 'redefine'; ## no critic(TestingAndDebugging::ProhibitNoWarnings)
*{$symbol} = sub {
my $blocking_feature = _blocking_feature(__PACKAGE__, $_[0], @features);
return $blocking_feature if $blocking_feature;
lib/Test/Virtual/Filesystem.pm view on Meta::CPAN
my ($pkg, $self, @features) = @_;
for my $feature (@features) {
return $feature . ' (no OS support)' if $feature_disabled{$feature};
my $opts = $self->{fs_opts};
for my $part (split m{/}xms, $feature) {
return $feature if !ref $opts;
return $feature if !$opts->{$part};
$opts = $opts->{$part};
}
}
lib/Test/Virtual/Filesystem.pm view on Meta::CPAN
sub _file {
my ($self, $path) = @_;
$path =~ s{\A /}{}xms or croak 'test paths must be absolute';
# Change path to proper OS format
return File::Spec->catfile($self->{tempdir}, split m{/}xms, $path);
}
sub _write_file {
my ($self, $f, @content) = @_;
open my $fh, '>', $f or die $OS_ERROR;
view all matches for this distribution
view release on metacpan or search on metacpan
t/warning_is.t view on Meta::CPAN
Test::Builder::Tester::color 'on';
use constant WARN_LINE => line_num +2;
sub _make_warn {
warn $_ for grep $_, split m:\|:, (shift() || "");
}
use constant CARP_LINE => line_num +2;
sub _make_carp {
carp $_ for grep $_, split m:\|:, (shift() || "");
}
use constant CARP_LEVELS => (0 .. 2);
sub _create_exp_warning {
my ($carplevel, $warning) = @_;
t/warning_is.t view on Meta::CPAN
*_make_warn_or_carp = $carp ? *_make_carp : *_make_warn;
for my $t (undef, $testname) {
test_out "$ok 1" . ($t ? " - $t" : "");
if ($ok =~ /not/) {
test_fail +4;
test_diag _found_msg($_) for ($msg ? (split m-\|-, $msg) : $msg);
test_diag _exp_msg($exp_warning);
}
warning_is {_make_warn_or_carp($msg)} _create_exp_warning($carp, $exp_warning), $t;
test_test "$testname (with" . ($_ ? "" : "out") . " a testname)";
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/css_selector.t view on Meta::CPAN
test_out( 'ok 1 - whatever');
$xp->ok('> html > head > title', 'whatever');
test_test('ok works');
# Try failed ok.
my $file = File::Spec->catfile(split m{/} => __FILE__);
test_out('not ok 1 - whatever');
test_err(qq{# Failed test 'whatever'\n# at $file line 34.});
$xp->ok('> html > head > foo', 'whatever');
test_test('ok fail works');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Yath/Command/server.pm view on Meta::CPAN
}
return @found;
}
my ($fname) = reverse(split m/\s+/, $text);
return Term::ReadLine::Gnu->filename_completion_function($fname // '', 0);
};
my $prompt = "\n> ";
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/TestHelper.pm view on Meta::CPAN
my ($test_file, $filter, $debug) = @_;
local $ENV{SUBTEST_FILTER} = defined $filter ? encode_utf8($filter) : undef;
local $ENV{SUBTEST_FILTER_DEBUG} = $debug // 1; # Default to enabled
my $file = File::Spec->catfile(split m!/!, $test_file);
my ($stdout, $stderr, $exit) = capture {
system($^X, '-Ilib', $file);
};
$stdout = decode_utf8($stdout);
view all matches for this distribution
view release on metacpan or search on metacpan
[INCOMPATIBLE CHANGES]
- ta_{,mb}pad() now does not handle multiline text (the implementation
was incorrect after all, "" should've been padded to "xxx" and "a\n"
should've been padded to "axx\nxxx"). You can now split multiline text
by yourself as you see fit.
0.04 2013-04-08 Released-By: SHARYANTO
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/CSV_PP.pm view on Meta::CPAN
my @c;
if ($type eq "cell") {
my @spec;
my $min_row;
my $max_row = 0;
for (split m/\s*;\s*/ => $range) {
my ($tlr, $tlc, $brr, $brc) = (m{
^ \s* ([0-9]+ ) \s* , \s* ([0-9]+ ) \s*
(?: - \s* ([0-9]+ | \*) \s* , \s* ([0-9]+ | \*) \s* )?
$}x) or croak($self->SetDiag(2013));
defined $brr or ($brr, $brc) = ($tlr, $tlc);
lib/Text/CSV_PP.pm view on Meta::CPAN
}
# row or col
my @r;
my $eod = 0;
for (split m/\s*;\s*/ => $range) {
my ($from, $to) = m/^\s* ([0-9]+) (?: \s* - \s* ([0-9]+ | \* ))? \s* $/x
or croak($self->SetDiag(2013));
$to ||= $from;
$to eq "*" and ($to, $eod) = ($from, 1);
# $to cannot be <= 0 due to regex and ||=
view all matches for this distribution
view release on metacpan or search on metacpan
my @c;
if ($type eq "cell") {
my @spec;
my $min_row;
my $max_row = 0;
for (split m/\s*;\s*/ => $range) {
my ($tlr, $tlc, $brr, $brc) = (m{
^ \s* ([0-9]+ ) \s* , \s* ([0-9]+ ) \s*
(?: - \s* ([0-9]+ | \*) \s* , \s* ([0-9]+ | \*) \s* )?
$}x) or croak ($self->SetDiag (2013));
defined $brr or ($brr, $brc) = ($tlr, $tlc);
}
# row or col
my @r;
my $eod = 0;
for (split m/\s*;\s*/ => $range) {
my ($from, $to) = m/^\s* ([0-9]+) (?: \s* - \s* ([0-9]+ | \* ))? \s* $/x
or croak ($self->SetDiag (2013));
$to ||= $from;
$to eq "*" and ($to, $eod) = ($from, 1);
# $to cannot be <= 0 due to regex and ||=
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
return $_[1];
};
}
{
map { my ($pk, $vr) = split m/\s/; build_requires $pk => $vr || 0 } grep { ! /^\s*#/ } split m/\n/, <<_END_;
Test::Most
_END_
map { my ($pk, $vr) = split m/\s/; requires $pk => $vr || 0 } grep { ! /^\s*#/ } split m/\n/, <<_END_;
_END_
}
if (-e 'inc/.author') {
my $all_from = join '/', 'lib', split m/-/, name . '.pm';
`perldoc -tF $all_from > README` if ! -e 'README' || (stat $all_from)[9] > (stat 'README')[9];
}
auto_install;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/Clip.pm view on Meta::CPAN
if ( $slurp{trim} ) {
s/^\s*//, s/\s*$//, for $content;
}
if ( wantarray && $slurp{wantlist} ) {
@content = grep { $_ ne "\n" } split m/(\n)/, $content;
@content = map { "$_\n" } @content unless $slurp{chomp};
return @content;
}
else {
return $content;
view all matches for this distribution
view release on metacpan or search on metacpan
# Parse all data.
sub parse {
my ($self, $data) = @_;
my @data_lines;
foreach my $line (split m/\n/ms, $data) {
if ($line =~ m/^\s*$/ms || $line =~ m/^\s*#/) {
next;
}
push @data_lines, [$self->parse_line($line)];
}
}
# Parse one line.
sub parse_line {
my ($self, $line) = @_;
my @data_line = split m/(?<!\\):/ms, $line;
foreach my $data (@data_line) {
$data =~ s/\\:/:/gms;
$data =~ s/\\n/\n/gms;
}
return @data_line;
view all matches for this distribution