view release on metacpan or search on metacpan
TT/Document.pm view on Meta::CPAN
push(@{$odocs[$oi]}, $sent);
$osizes[$oi] += scalar(@$sent);
++$oi if ($osizes[$oi] >= $osize);
}
} else {
##-- best-split mode
my ($sent,$oi,$oi_min);
foreach $sent (@$doc) {
##-- find smallest @odoc
$oi_min = 0;
foreach $oi (1..$#odocs) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Lingua/XFST/Network.pm view on Meta::CPAN
sub _do_apply {
my ($self, $string) = @_;
my $output = Lingua::XFST::Privates::apply_to_string($string, $self->{apply});
return [split m/$splitter/o, $output];
}
# XXX: Looks like this doesn't free all the memory. Need to figure out how to
# fix that.
sub DESTROY {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Lingua/ZH/CEDICT.pm view on Meta::CPAN
# my $separator = "/";
# $en =~ s|/|$separator|g;
# return $en;
my @terms = split m|/|, $en;
foreach (0..$#terms) {
$terms[$_] =~ s|\(([^(]+)\)$|<i>$1</i>|;
}
view all matches for this distribution
view release on metacpan or search on metacpan
script/dvbt-ts-cut view on Meta::CPAN
ad=970972:1417421
ad=2085377:2477139
ad=3472767:3856038
In -split mode, the specified B<outfile> name will be used but suffixed with a count starting at 1.
=head1 FURTHER DETAILS
For full details of the DVBT functions, please see L<Linux::DVB::DVBT::TS>:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Linux/Info/ProcStats.pm view on Meta::CPAN
my $filename =
$file->{path} ? "$file->{path}/$file->{loadavg}" : $file->{loadavg};
open my $fh, '<', $filename
or croak "$class: unable to open $filename ($!)";
( $lavg->{runqueue}, $lavg->{count} ) =
( split m@/@, ( split /\s+/, <$fh> )[3] );
close($fh);
return $lavg;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Linux/PacketFilter.pm view on Meta::CPAN
for my $filter (@_) {
my $code = 0;
my $tmpl;
for my $piece ( split m<\s+>, $filter->[0] ) {
$code |= ($BPF{$piece} // die "Unknown BPF option: â$pieceâ");
$tmpl ||= _NETWORK_INSTR_PACK()->{$piece};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Linux/Perl/SigSet.pm view on Meta::CPAN
for my $sig (@list) {
if ($sig =~ tr<0-9><>c) {
$sig_num_hr ||= do {
require Config;
my @names = split m< >, $Config::Config{'sig_name'};
my %signum;
@signum{@names} = split m< >, $Config::Config{'sig_num'};
\%signum;
};
$sig = $sig_num_hr->{$sig} || die "Unrecognized signal: '$sig'";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Linux/SocketFilter/Assembler.pm view on Meta::CPAN
my $self = __PACKAGE__;
my ( $text ) = @_;
my $ret = "";
foreach ( split m/\n/, $text ) {
s/^\s+//; # trim whitespace
next if m/^$/; # skip blanks
next if m/^;/; # skip comments
my ( $op, $args ) = split ' ', $_, 2;
my @args = defined $args ? split m/,\s*/, $args : ();
$self->can( "assemble_$op" ) or
die "Can't compile $_ - unrecognised op '$op'\n";
$ret .= $self->${\"assemble_$op"}( @args );
view all matches for this distribution
view release on metacpan or search on metacpan
bin/realtimed view on Meta::CPAN
sub initTree {
my ($conf) = @_;
my $path = getCanonicalPath($conf->{path});
return unless $path;
my $curpath = '';
my @path = split m|/|, $path;
shift @path;
my $version = $conf->{version};
$dirtree->{conf}->{$version} //= {};
my $node = $dirtree->{conf}->{$version};
for (@path) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/70deparse.t view on Meta::CPAN
# Deparsed output is '{ ... }'-wrapped
$got = ( $got =~ m/^{\n(.*)\n}$/s )[0];
# Deparsed output will have a lot of pragmata and so on; just grab the
# final line
$got = ( split m/\n/, $got )[-1];
$got =~ s/^\s+//;
is( $got, $exp, $name );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Lithium/WebDriver.pm view on Meta::CPAN
{
my ($self) = @_;
if ($self->{browser} =~ m/phantomjs/i) {
if($self->{ua}) {
debug "setting capabilities in Phantom Driver";
my ($ua_platform, $ua_browser) = split m/\s*[-_ ]\s*/, $self->{ua};
$ua_platform = lc $ua_platform if $ua_platform;
$ua_browser = lc $ua_browser if $ua_browser;
if ($ua_platform && $ua_browser && $user_agents->{$ua_platform}{$ua_browser}) {
$self->{ua} = $user_agents->{$ua_platform}{$ua_browser};
debug "Setting user-agent to: $self->{ua}";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Locale/Babelfish.pm view on Meta::CPAN
wanted => sub {
my $file = File::Spec->rel2abs( $File::Find::name );
return unless -f $file;
my ( $volume, $directories, $base ) = File::Spec->splitpath( $file );
my @tmp = split m/\./, $base;
my $cur_suffix = pop @tmp;
return unless $cur_suffix eq $self->suffix;
my $lang = pop @tmp;
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/Locale/MO/File.pm view on Meta::CPAN
# return value
my %message;
# split original
my @strings = split m{ \Q$CONTEXT_SEPARATOR\E }xms, $msgid;
if ( @strings > 1 ) {
( $message{msgctxt}, $msgid ) = @strings;
}
my @plurals = split m{ \Q$PLURAL_SEPARATOR\E }xms, $msgid;
my $is_plural = @plurals > 1;
if ( $is_plural ) {
@message{qw(msgid msgid_plural)} = @plurals;
}
else {
$message{msgid} = $msgid;
}
# split translation
@plurals = split m{ \Q$PLURAL_SEPARATOR\E }xms, $msgstr, -1; ## no critic (MagicNumbers)
if ( $is_plural ) {
$message{msgstr_plural} = \@plurals;
}
else {
$message{msgstr} = $plurals[0];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Locale/PO/Callback.pm view on Meta::CPAN
if ($comment =~ /^#: (.*):(\d*)$/) {
push @{ $stanza->{'locations'} }, [$1, $2];
} elsif ($comment =~ /^#, (.*)$/) {
my $flags = $1;
$flags =~ s/\s*,\s*/,/g;
for my $flag (split m/,/, $flags) {
$stanza->{'flags'}->{lc $flag} = 1;
}
} else {
push @comments, $comment;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Locale/TextDomain/OO/Extract/Perl.pm view on Meta::CPAN
: do { $is_pod = 1; q{} }
)
: $is_pod ? q{}
: $_;
}
split m{ \r? \n }xms, ${$content_ref};
# replace heredoc's without killing the line number
# <<'...'
REPLACE: {
${$content_ref} =~ s{
view all matches for this distribution
view release on metacpan or search on metacpan
t/02_join_split.t view on Meta::CPAN
{
msgctxt => 'my context',
msgid => 'my singular',
msgid_plural => 'my plural',
},
'split message key';
}
MESSAGE_KEY_JSON: {
is
$key_util->join_message_key(undef, 'JSON'),
t/02_join_split.t view on Meta::CPAN
{
msgstr_plural => [ 'tr singular', 'tr plural' ],
reference => { 'dir/file:123' => undef },
},
],
'split message';
}
MESSAGE_JSON: {
eq_or_diff
$key_util->join_message(undef, undef, 'JSON'),
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Locale/TextDomain/OO/Lexicon/Role/File.pm view on Meta::CPAN
my @files = $self->_my_glob($file);
for ( @files ) {
my $filename = $_->canonpath;
my $lexicon_language_key = $lexicon_key;
my $language = $filename;
my @parts = split m{[*]}xms, $file;
if ( @parts == 2 ) {
substr $language, 0, length $parts[0], q{};
substr $language, - length $parts[1], length $parts[1], q{};
$lexicon_language_key =~ s{[*]}{$language}xms;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Locale/Utils/Autotranslator.pm view on Meta::CPAN
my $paragraph = $_;
$paragraph =~ s{ \A ( \s* ) }{ push @prefix, $1; q{} }xmse; # left
$paragraph =~ s{ ( \s* ) \z }{ push @suffix, $1; q{} }xmse; # right
$paragraph;
}
split m{ \n [^\S\n]* \n }xms, $msgid;
$has_network_line_endings
and $msgstr =~ s{ \n }{\r\n}xmsg;
return $msgstr;
}
lib/Locale/Utils/Autotranslator.pm view on Meta::CPAN
$line =~ s{ \A ( \s* ) }{ push @prefix, $1; q{} }xmse; # left
$line =~ s{ ( \s* ) \z }{ push @suffix, $1; q{} }xmse; # right
$line =~ s{ \s+ }{ }xmsg; # inner
$line;
}
split m{ \n }xms, $msgid;
}
sub _bytes_max_fail_message {
my ( $self, $msgid ) = @_;
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
# 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
# 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
# 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/Log/Deep.pm view on Meta::CPAN
sub log_handle {
my $self = shift;
if ( !$self->{handle} ) {
$self->{log_dir} ||= $ENV{TMP} || '/tmp';
$self->{log_name} ||= (split m{/}, $0)[-1] || 'deep';
$self->{date_fmt} ||= '%Y-%m-%d';
$self->{log_date} = strftime $self->{date_fmt}, localtime;
my $file = $self->{file} || "$self->{log_dir}/$self->{log_name}_$self->{log_date}.log";
view all matches for this distribution
view release on metacpan or search on metacpan
Line/Data.pm view on Meta::CPAN
};
if ($EVAL_ERROR) {
err "Cannot load 'DateTime' class.",
'Error', $EVAL_ERROR;
}
my ($year, $month, $day) = split m/-/ms, $self->date;
my ($hour, $min, $sec_mili) = split m/:/ms, $self->time;
my ($sec, $mili) = split m/\./ms, $sec_mili;
if (! defined $mili) {
$mili = 0;
}
my $dt = eval {
DateTime->new(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Log/Log4perl/Tiny.pm view on Meta::CPAN
if $emit_log || $LOGDIE_MESSAGE_ON_STDERR;
if ($emit_log) { # avoid unless we're allowed to emit
my $message = Carp->can($renderer)->(@message);
my $method = $self->can($log_level);
$self->$method($_) for split m{\n}mxs, $message;
}
if ($LOGDIE_MESSAGE_ON_STDERR) {
Carp->can($emitter)->(@message);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Log/Report/Util.pm view on Meta::CPAN
sub expand_reasons($)
{ my $reasons = shift or return ();
$reasons = [ split m/\,/, $reasons ] if ref $reasons ne 'ARRAY';
my %r;
foreach my $r (@$reasons)
{ if($r =~ m/^([a-z]*)\-([a-z]*)/i )
{ my $begin = $reason_code{$1 || 'TRACE'};
view all matches for this distribution
view release on metacpan or search on metacpan
buildlib/Lucy/Test/TestUtils.pm view on Meta::CPAN
my $frowny = $not_a_smiley;
utf8::upgrade($frowny);
return ( $smiley, $not_a_smiley, $frowny );
}
# Verify an Analyzer's transform, transform_text, and split methods.
sub test_analyzer {
my ( $analyzer, $source, $expected, $message ) = @_;
my $inversion = Lucy::Analysis::Inversion->new( text => $source );
$inversion = $analyzer->transform($inversion);
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Foo/Bar/1.pm view on Meta::CPAN
use Moo;
extends 'Foo::Bar::0';
has 'foo' => (
is => 'ro',
default => sub { ( split m{::}, __PACKAGE__ )[-1] },
);
sub BUILDARGS {
my ( $class, @args ) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
Wikidata/Transform.pm view on Meta::CPAN
return;
}
my $full_name = $field->subfield('a');
# TODO Only if type 1. Fix for type 0 and 2.
my ($surname, $name) = split m/,\s*/ms, $full_name;
my $nkcr_aut = $field->subfield('7');
my $dates = $field->subfield('d');
my ($date_of_birth, $date_of_death, $work_period_start, $work_period_end);
if (defined $dates) {
my $active_re = decode_utf8('Äinný');
if ($dates =~ m/^$active_re\s*(.*)/ms) {
my ($start_date, $end_date) = split m/-/ms, $1;
$work_period_start = clean_date($start_date);
$work_period_end = clean_date($end_date);
} else {
my ($start_date, $end_date) = split m/-/ms, $dates;
$date_of_birth = clean_date($start_date);
$date_of_death = clean_date($end_date);
}
}
view all matches for this distribution