view release on metacpan or search on metacpan
lib/Acme/eng2kor.pm view on Meta::CPAN
);
sub translate {
my ($self, $word) = @_;
map { s/^\s+//; s/\s+$// } $word if defined $word;
return $self->_google_translate($word);
}
sub _google_translate {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/require/case.pm view on Meta::CPAN
my ( $prefix, $filename ) = @_;
my $search = path($prefix); # clone
my @parts = split qr{/}, $filename;
my $valid = 1;
while ( my $p = shift @parts ) {
if ( grep { $p eq $_ } map { $_->basename } $search->children ) {
$search = $search->child($p);
}
else {
$valid = 0;
my ($actual) = grep { lc $p eq lc $_ } map { $_->basename } $search->children;
$search = $search->child($actual);
}
}
return ( $valid, $search->relative($prefix) );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acrux/DBI.pm view on Meta::CPAN
}
my $rv;
my $argb = '';
if (scalar @$bind_values) {
$argb = sprintf(" with bind values: %s",
join(", ", map {defined($_) ? sprintf("'%s\'", $_) : 'undef'} @$bind_values));
$rv = $sth->execute(@$bind_values);
} elsif (my $cb = $args->{bind_callback} || $args->{bind_cb}) {
unless (is_code_ref($cb)) {
$self->error("Invalid binding callback function. Code ref expected");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Crux.pm view on Meta::CPAN
}
unless (File::Spec->file_name_is_absolute($pidfile)) {
$self->{pidfile} = $pidfile = File::Spec->rel2abs($pidfile);
}
# Define plugins list to plugin map
$self->plugins(as_hash_ref($args->{plugins}));
# Preloading plugins
my $preload_plugins = $self->{preload_plugins};
$preload_plugins = [$preload_plugins] unless is_array_ref($preload_plugins);
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-report-prereqs.t view on Meta::CPAN
}
if ( @reports ) {
push @full_reports, "=== $title ===\n\n";
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
if ($type eq 'modules') {
splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
}
else {
splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
}
push @full_reports, "\n";
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Action/Retry.pm view on Meta::CPAN
Here is an example of code that gets the arguments properly:
my $action = Action::Retry->new(
attempt_code => sub { do_stuff; } )->run();
attempt_code => sub { map { $_ * 2 } @_ }
retry_if_code => sub {
my ($error, $h) = @_;
my $attempt_code_result = $h->{attempt_result};
my $attempt_code_params = $h->{attempt_parameters};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Activator/DB.pm view on Meta::CPAN
$sql ||= '';
$bind ||= [];
if ( ref( $bind ) eq 'ARRAY' ) {
my @vals = @$bind;
map {
if ( !defined($_) ) {
$_ = 'NULL';
}
else {
$_ = "'$_'";
lib/Activator/DB.pm view on Meta::CPAN
];
=item *
C<getall_hashrefs()> returns an arrayref of of rows represented by
hashrefs of column name => value mappings.
$rowrefs is [ { col1 => val, col2 => val },
{ col1 => val, col2 => val },
];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ActiveRecord/Simple.pm view on Meta::CPAN
my $table_name = _what_is_the_table_name($self);
my @field_names = grep { defined $param->{$_} } sort keys %$param;
my $primary_key = ($self->can('_get_primary_key')) ? $self->_get_primary_key :
($self->can('_get_secondary_key')) ? $self->_get_secondary_key : undef;
my $field_names_str = join q/, /, map { q/"/ . $_ . q/"/ } @field_names;
my (@bind, @values_list);
for (@field_names) {
if (ref $param->{$_} eq 'SCALAR') {
push @values_list, ${ $param->{$_} };
lib/ActiveRecord/Simple.pm view on Meta::CPAN
}
sub _delete_keys {
my ($self, $rx) = @_;
map { delete $self->{$_} if $_ =~ $rx } keys %$self;
}
sub _append_relation {
my ($class, $rel_name, $rel_hashref) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# Normalise multipart versions
$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
}
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
my @v = map {
$_ . '0' x (3 - length $_)
} $s =~ /(\d{1,3})\D?/g;
$l = $l . '.' . join '', @v if @v;
return $l + 0;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Activiti/Rest/Client.pm view on Meta::CPAN
die("no parsed content") unless $res->has_parsed_content;
my $pdefs = $res->parsed_content;
my @ids = map { $_->{id} } @{ $pdefs->{data} };
for my $id(@ids){
print Dumper($client->process_definition(processDefinitionId => $id)->parsed_content);
}
=head1 CONSTRUCTOR parameters
view all matches for this distribution
view release on metacpan or search on metacpan
ex/ai-bot.pl view on Meta::CPAN
$limit //= 5;
my $rows = $self->_dbh->selectall_arrayref(
'SELECT nick, message, response FROM conversations WHERE message LIKE ? OR response LIKE ? ORDER BY id DESC LIMIT ?',
{ Slice => {} }, "%$query%", "%$query%", $limit,
);
return join("\n---\n", map { "<$_->{nick}> $_->{message}\n$_->{response}" } @$rows);
}
sub save_note {
my ($self, $nick, $content) = @_;
$self->_dbh->do('INSERT INTO notes (nick, content) VALUES (?,?)', undef, $nick, $content);
ex/ai-bot.pl view on Meta::CPAN
$rows = $self->_dbh->selectall_arrayref(
'SELECT id, nick, content FROM notes WHERE content LIKE ? ORDER BY id DESC LIMIT ?',
{ Slice => {} }, "%$query%", $limit,
);
}
return join("\n", map { "#$_->{id} [$_->{nick}] $_->{content}" } @$rows);
}
sub update_note {
my ($self, $id, $content) = @_;
my $rows = $self->_dbh->do('UPDATE notes SET content = ? WHERE id = ?', undef, $content, $id);
ex/ai-bot.pl view on Meta::CPAN
}
}
# Scan message text for nicks mentioned by name (check against channel members)
my @channel_nicks = eval { $self->irc->nicks($channel) } || ();
if (@channel_nicks) {
my %chan_nicks = map { lc($_) => $_ } @channel_nicks;
for my $m (@messages) {
for my $word (split /\W+/, $m->{msg}) {
if (my $real = $chan_nicks{lc $word}) {
$seen_nicks{$real} = 1;
}
ex/ai-bot.pl view on Meta::CPAN
}
}
my $input = '';
$input .= $context if $context;
$input .= join("\n", map {
my $prefix = $_->{nick};
if ($prefix ne 'system' && $self->irc->is_channel_operator($channel, $prefix)) {
$prefix = '@' . $prefix;
}
"<$prefix> $_->{msg}";
ex/ai-bot.pl view on Meta::CPAN
$answer =~ s/<\/?\w+>//g; # strip remaining XML tags
# Strip lines where the AI narrates its tool usage
$answer =~ s/^\*?\s*(save_note|recall_notes|update_note|delete_note|recall_history|stay_silent|set_alarm|whois|send_private_message)\b[^\n]*\n?//mg;
# Check for lines too long
my @lines = grep { length } map { s/^\s+//r =~ s/\s+$//r } split(/\n/, $answer);
my $too_long = grep { length($_) > $MAX_LINE } @lines;
if ($too_long) {
$self->info("Response too long, asking to shorten");
$answer = eval {
my $retry = $self->_raider->raid(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Adapter/Async/Model.pm view on Meta::CPAN
UnorderedMap => 'Adapter::Async::UnorderedMap::Hash',
OrderedList => 'Adapter::Async::OrderedList::Array',
);
if(defined(my $from = $details->{from})) {
$log->tracef("Should apply field %s from %s for %s", $k, $from, $pkg);
++$loader{$_} for grep /::/, map $type_expand->($_), @{$details}{qw(type)};
} else {
no strict 'refs';
no warnings 'once';
push @{$pkg . '::attrs'}, $k unless $details->{collection}
}
if(my $type = $details->{collection}) {
my $collection_class = $collection_class_for{$type} // die "unknown collection $type";
++$loader{$collection_class};
$log->tracef("%s->%s collection: %s", $pkg, $k, $type);
++$loader{$_} for grep /::/, map $type_expand->($_), @{$details}{qw(key item)};
$code = sub {
my $self = shift;
die "no args expected" if @_;
$self->{$k} //= $collection_class->new;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AddressBook.pm view on Meta::CPAN
sub get_cannonical_attribute_names {
my $self=shift;
my $class = ref $self || croak "Not a method call.";
my @fields = $self->get_attribute_names;
my @names = map {$self->{config}->{db2generic}->{$self->{db_name}}->{$_}} @fields;
return @names;
}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ado/Build.pm view on Meta::CPAN
create_build_script process_etc_files do_create_readme
process_public_files process_templates_files
ACTION_perltidy ACTION_submit PERL_DIRS);
sub PERL_DIRS {
state $dirs = [map { catdir($_[0]->base_dir, $_) } qw(bin lib etc t)];
return @$dirs;
}
sub create_build_script {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Advanced/Config/Date.pm view on Meta::CPAN
# Updated by: init_special_date_arrays() ...
# May be for a different language than the above hashes ...
my $prev_array_lang = "English";
my @gMoY = qw ( January February March April May June
July August September October November December );
my @gMoYs = map { uc (substr($_,0,3)) } @gMoY;
my @gDsuf = sort { my ($x,$y) = ($a,$b); $x=~s/\D+$//; $y=~s/\D+$//; $x<=>$y } grep (/^\d+\D+$/, keys %Days, "0th");
my @gDoW = qw( Sunday Monday Tuesday Wednesday Thursday Friday Saturday );
my @gDoWs = map { uc (substr($_,0,3)) } @gDoW;
# ==============================================================
# Not in pod on purpose. Only added to simplify test cases.
sub _date_language_installed
lib/Advanced/Config/Date.pm view on Meta::CPAN
$last_language_edit_flags{language} = $lang;
# ---------------------------------------------------------
# Bug Alert: For some languges the following isn't true!
# lc(MoY) != lc(uc(lc(MoY)))
# So we have multiple lower case letters mapping to the
# same upper case letters#.
# ---------------------------------------------------------
# This happens for 3 languages for Date::Language.
# Chinese_GB, Greek & Russian_cp1251
# And one language for Date::Manip
lib/Advanced/Config/Date.pm view on Meta::CPAN
# If the new language was valid, update the global variables ...
if ( $MoY_ref ) {
$prev_array_lang = $lang;
@gMoY = @{$MoY_ref};
@gMoYs = map { uc($_) } @{$MoYs_ref};
@gDoW = @{$DoW_ref};
@gDoWs = map { uc($_) } @{$DoWs_ref};
@gDsuf = @{$Dsuf_ref};
DBUG_PRINT ( "LANGUAGE", "%s\n%s\n%s\n%s\n%s",
join (", ", @gMoY), join (", ", @gMoYs),
join (", ", @gDoW), join (", ", @gDoWs),
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bundle/Advent/Year2006.pm view on Meta::CPAN
Devel::SmallProf - L<pod|Devel::SmallProf>, L<http://www.perladvent.org/2006/01/>
File::Find::Object - L<pod|File::Find::Object>, L<http://www.perladvent.org/2006/02/>
Treemap - L<pod|Treemap>, L<http://www.perladvent.org/2006/03/>
CGI::Minimal - L<pod|CGI::Minimal>, L<http://www.perladvent.org/2006/04/>
ack - L<pod|ack>, L<http://www.perladvent.org/2006/05/>
view all matches for this distribution
view release on metacpan or search on metacpan
Infix2Postfix.pm view on Meta::CPAN
if (!exists( $op->{'type'} )) { $op->{'type'}='binary'; }
if (!exists( $op->{'assoc'} )) { $op->{'assoc'}='left'; }
if (!exists( $op->{'trans'} )) { $op->{'trans'}=$op->{'op'}; }
}
@{$self->{'opr'}}=map { $_->{'op'} } @{$self->{'ops'}};
@{$self->{'tokens'}}=(@{$self->{'opr'}},@{$self->{'func'}},@{$self->{'vars'}},@{$self->{'grouping'}});
$self->{'varre'}=join('|',map { quotemeta($_) } @{$self->{'vars'}});
$self->{'funcre'}=join('|',map { quotemeta($_) } @{$self->{'func'}});
$self->{'numre'}='[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?';
$self->{'re'}=join('|',(map { quotemeta($_).'(?!'.quotemeta($_).')' } @{$self->{'tokens'}}),$self->{'numre'});
$self->{'ree'}=$self->{'re'}.'|.+?';
$self->{ERRSTR}='';
bless $self,$class;
return $self;
}
Infix2Postfix.pm view on Meta::CPAN
@func=@{$self->{'func'}};
@func{@func}=1..@func;
@ops=@{$self->{'ops'}};
# print Dumper(\%func);
# print "elist: ",join(" ",map { "$_" } @_ ),"\n";
# the only single elements should be numbers or vars
if ($#_ == 0) {
if ( $_[0] =~ m/^($numre|$varre)$/ ) {
view all matches for this distribution
view release on metacpan or search on metacpan
builder/Affix/Builder.pm view on Meta::CPAN
method write_file( $filename, $content ) { path($filename)->spew_raw($content) or die "Could not open $filename: $!\n" }
method read_file ($filename) { path($filename)->slurp_utf8 or die "Could not open $filename: $!\n" }
method step_build() {
$self->step_affix;
my %modules = map { $_ => catfile( 'blib', $_ ) } find( qr/\.pm$/, 'lib' );
my %docs = map { $_ => catfile( 'blib', $_ ) } find( qr/\.pod$/, 'lib' );
my %scripts = map { $_ => catfile( 'blib', $_ ) } find( qr/(?:)/, 'script' );
my %sdocs = map { $_ => delete $scripts{$_} } grep {/.pod$/} keys %scripts;
my %dist_shared = map { $_ => catfile( qw[blib lib auto share dist], $meta->name, abs2rel( $_, 'share' ) ) } find( qr/(?:)/, 'share' );
my %module_shared = map { $_ => catfile( qw[blib lib auto share module], abs2rel( $_, 'module-share' ) ) } find( qr/(?:)/, 'module-share' );
pm_to_blib( { %modules, %docs, %scripts, %dist_shared, %module_shared }, catdir(qw[blib lib auto]) );
make_executable($_) for values %scripts;
make_path( catdir(qw[blib arch]), { chmod => 0777, verbose => $verbose } );
0;
}
builder/Affix/Builder.pm view on Meta::CPAN
method step_install() {
$self->step_build() unless -d 'blib';
my %res;
install(
[ from_to => $install_paths->install_map,
verbose => $verbose,
always_copy => 1,
dry_run => $dry_run,
uninst => $uninst,
result => \%res
builder/Affix/Builder.pm view on Meta::CPAN
require TAP::Harness::Env;
my %test_args = (
( verbosity => $verbose ),
( jobs => $jobs ),
( color => -t STDOUT ),
lib => [ map { rel2abs( catdir( 'blib', $_ ) ) } qw[arch lib] ],
);
TAP::Harness::Env->create( \%test_args )->runtests( sort map { $_->stringify } find( qr/\.t$/, 't' ) )->has_errors;
}
method get_arguments (@sources) {
$_ = detildefy($_) for grep {defined} $install_base, $destdir, $prefix, values %{$install_paths};
$install_paths = ExtUtils::InstallPaths->new( dist_name => $meta->name );
builder/Affix/Builder.pm view on Meta::CPAN
$self->write_file( 'Build', sprintf <<'', $^X, __PACKAGE__, __PACKAGE__ );
#!%s
use lib 'builder';
use %s;
%s->new( @ARGV && $ARGV[0] =~ /\A\w+\z/ ? ( action => shift @ARGV ) : (),
map { /^--/ ? ( shift(@ARGV) =~ s[^--][]r => 1 ) : /^-/ ? ( shift(@ARGV) =~ s[^-][]r => shift @ARGV ) : () } @ARGV )->Build();
make_executable('Build');
my @env = defined $ENV{PERL_MB_OPT} ? split_like_shell( $ENV{PERL_MB_OPT} ) : ();
$self->write_file( '_build_params', encode_json( [ \@env, \@ARGV ] ) );
if ( my $dynamic = $meta->custom('x_dynamic_prereqs') ) {
builder/Affix/Builder.pm view on Meta::CPAN
elsif ( $cc_cmd =~ /gcc/i ) { $cc_type = 'gcc'; }
elsif ( $cc_cmd =~ /egcc/i ) { $cc_type = 'gcc'; }
# Setup Flags
my ( $ar_cmd, @cflags, @arflags, $out_flag_cc, $out_flag_ar );
my @includes = map { ( $cc_type eq 'msvc' ? '/I' : '-I' ) . $_ } @include_dirs;
if ( $cc_type eq 'msvc' ) {
$ar_cmd = 'lib';
@cflags = ( '/nologo', '/c', '/std:c11', '/W3', '/GS', '/MD', '/O2', @includes );
@cflags = ( @cflags, '/DINFIX_DEBUG_ENABLED=1' ) if $verbose;
@arflags = ('/nologo');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Agent/TCLI/Command.pm view on Meta::CPAN
my @aliases;
if ( ref( $context_hash_key ) =~ /ARRAY/ )
{
# There is a list of aliases to add.
push( @aliases , @{$context_hash_key} );
# %aliases = map { $_ => $self } @{$context_hash_key} };
}
elsif ( ref( $context_hash_key ) =~ /HASH/ )
{
# There are context shifts to add.
foreach my $key (keys %{$context_hash_key} )
{
push( @aliases , $key ) unless ( $key =~ qr(\*U) );
}
# %aliases = map { $_ => $self } keys %{$context_hash_key};
}
else
{
# There is a single alias to add.
push( @aliases , $context_hash_key );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Annotation.pm view on Meta::CPAN
return \%remark if !-e $remark_path;
open my $f, "<:utf8", $remark_path or do { warn "$remark_path not opened: $!"; return \%remark };
while(<$f>) {
warn "$remark_path corrupt on line $.!" unless /^([\w:]+)#(\w*),(\d+)=(.*)$/;
$remark{$1}{$2} = [$3, [map { s/\\(.)/$1/gr } split /\\n/, $4]];
}
close $f;
\%remark
});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Emitter/ListenersRun.pm view on Meta::CPAN
package Aion::Emitter::ListenersRun;
# СпиÑок ÑлÑÑаÑелей
use common::sense;
use List::Util qw/pairmap max/;
use Aion::Format qw/printcolor/;
use Aion;
with qw/Aion::Run/;
lib/Aion/Emitter/ListenersRun.pm view on Meta::CPAN
#@run emit:listeners âList of listenersâ
sub list {
my ($self) = @_;
my @listeners = sort { $a->{evt} eq $b->{evt}? $a->{nice} <=> $b->{nice}: $a->{evt} cmp $b->{evt} }
pairmap { my $evt = $a; map { +{ %$_, evt => $evt, act => "$_->{pkg}#$_->{sub}", nice => 0+$_->{nice} } } @$b }
%{$self->emitter->event};
@listeners = grep { /$self->{mask}/ } @listeners if $self->mask ne "";
my $evtlen = max map length $_->{evt}, @listeners;
my $actlen = max map length $_->{act}, @listeners;
my $nicelen = max map length $_->{nice}, @listeners;
for my $listener_bag (@listeners) {
printcolor "#{blue}%+${nicelen}s#r #green%-${evtlen}s #{red}%-${actlen}s #{bold black}%s#r\n", @$listener_bag{qw/nice evt act remark/};
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Enum.pm view on Meta::CPAN
}
# ÐадаÑÑ ÑÐ¸Ð¿Ñ Ð´Ð»Ñ value и stash
sub issa(@) {
my $pkg = caller;
my ($nameisa, $valueisa, $stashisa, $aliasisa) = map { ref $_ eq '' ? eval "package $pkg; $_" || die : $_ } @_;
$Aion::META{$pkg}{issa} = {
name => $nameisa,
value => $valueisa,
stash => $stashisa,
alias => $aliasisa,
lib/Aion/Enum.pm view on Meta::CPAN
}
# Ðмена
sub names {
my ($cls) = @_;
map $_->{name}, $cls->cases
}
# ÐнаÑениÑ
sub values {
my ($cls) = @_;
map $_->{value}, $cls->cases
}
# ÐополнениÑ
sub stashes {
my ($cls) = @_;
map $_->{stash}, $cls->cases
}
# ÐÑевдонимÑ
sub aliases {
my ($cls) = @_;
map $_->alias, $cls->cases
}
my %ALIAS;
sub _alias {
my ($cls) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Format.pm view on Meta::CPAN
#
sub matches($@) { goto &replace }
sub replace($@) {
my $s = shift;
my $i = 0;
my $re = join "\n| ", map { $i++ % 2 == 0? "(?<I$i> $_ )": () } @_;
my $arg = \@_;
my $fn = sub {
for my $k (keys %+) {
return $arg->[$k]->() if do { $k =~ /^I(\d+)\z/ and $k = $1 }
}
lib/Aion/Format.pm view on Meta::CPAN
}
# УпÑоÑÑннÑй ÑзÑк ÑегÑлÑÑок
sub nous($) {
my ($templates) = @_;
my $x = join "|", map {
replace $_,
# СÑезаем вÑе пÑÐ¾Ð±ÐµÐ»Ñ Ñ ÐºÐ¾Ð½Ñа:
qr!\s*$! => sub {},
# СÑезаем вÑе наÑалÑнÑе ÑÑÑоки:
qr!^([ \t]*\n)*! => sub {},
lib/Aion/Format.pm view on Meta::CPAN
$s
}
# ÐÑполÑÐ·Ð¾Ð²Ð°Ð½Ñ ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ Ð¸Ð· кодиÑовки cp1251, ÑÑо нÑжно Ð´Ð»Ñ ÐºÐ¾ÑÑекÑной запиÑи в ÑаблиÑÑ
our $CIF = join "", "0".."9", "A".."Z", "a".."z", "_-", # 64 Ñимвола Ð´Ð»Ñ 64-ÑиÑной ÑиÑÑÐµÐ¼Ñ ÑÑиÑлениÑ
(map chr, ord "Ð" .. ord "Я"), "ÐÐÐÐÐÐÐÐÐÐÒÐÐÐÐ
",
(map chr, ord "а" .. ord "Ñ"), "ÑÑÑÑÑÑÑÑÑÑÒÑÑÑÑ",
"âââ¦â â¡â¬â°â¹âââââ¢âââ¢âºÂ¤Â¦Â§Â©Â«Â¬Â®°±µ¶·â»", do { no utf8; chr 0xa0 }, # небÑквеннÑе ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ Ð¸Ð· cp1251
"!\"#\$%&'()*+,./:;<=>?\@[\\]^`{|}~", # ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ Ð¿ÑнкÑÑаÑии ASCII
" ", # пÑобел
(map chr, 0 .. 0x1F, 0x7F), # ÑпÑавлÑÑÑие ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ ASCII
# Ñимвол 152 (0x98) в cp1251 оÑÑÑÑÑÑвÑеÑ.
;
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð½Ð°ÑÑÑалÑное ÑиÑло в заданнÑÑ ÑиÑÑÐµÐ¼Ñ ÑÑиÑлениÑ
sub to_radix($;$) {
use bigint;
lib/Aion/Format.pm view on Meta::CPAN
=head2 to_str (;$scalar)
Convert to Perl string without interpolation.
to_str "a'\n" # => 'a\\'\n'
[map to_str, "a'\n"] # --> ["'a\\'\n'"]
=head2 from_str (;$one_quote_str)
Conversion from Perl string without interpolation.
from_str "'a\\'\n'" # => a'\n
[map from_str, "'a\\'\n'"] # --> ["a'\n"]
=head1 SUBROUTINES/METHODS
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lay mkpath "hello/big/world.txt", "hellow!";
lay mkpath "hello/small/world.txt", "noenter";
mtime "hello"; # ~> ^\d+(\.\d+)?$
[map cat, grep -f, find ["hello/big", "hello/small"]]; # --> [qw/ hellow! noenter /]
my @noreplaced = replace { s/h/$a $b H/ }
find "hello", "-f", "*.txt", qr/\.txt$/, sub { /\.txt$/ },
noenter "*small*",
errorenter { warn "find $_: $!" };
### See also
* [AudioFile::Find](https://metacpan.org/pod/AudioFile::Find) â иÑÐµÑ Ð°ÑдиоÑÐ°Ð¹Ð»Ñ Ð² Ñказанной диÑекÑоÑии. ÐозволÑÐµÑ ÑилÑÑÑоваÑÑ Ð¸Ñ
по аÑÑибÑÑам: названиÑ, аÑÑиÑÑÑ, жа...
* [Directory::Iterator](https://metacpan.org/pod/Directory::Iterator) â `$it = Directory::Iterator->new($dir, %opts); push @paths, $_ while <$it>`.
* [IO::All](https://metacpan.org/pod/IO::All) â `@paths = map { "$_" } grep { -f $_ && $_->size > 10*1024 } io(".")->all(0)`.
* [IO::All::Rule](https://metacpan.org/pod/IO::All::Rule) â `$next = IO::All::Rule->new->file->size(">10k")->iter($dir1, $dir2); push @paths, "$f" while $f = $next->()`.
* [File::Find](https://metacpan.org/pod/File::Find) â `find( sub { push @paths, $File::Find::name if /\.png/ }, $dir )`.
* [File::Find::utf8](https://metacpan.org/pod/File::Find::utf8) â как [File::Find](https://metacpan.org/pod/File::Find), ÑолÑко пÑÑи Ñайлов в _utf8_.
* [File::Find::Age](https://metacpan.org/pod/File::Find::Age) â ÑоÑÑиÑÑÐµÑ ÑÐ°Ð¹Ð»Ñ Ð¿Ð¾ вÑемени модиÑикаÑии (наÑледÑÐµÑ [File::Find::Rule](https://metacpan.org/pod/File::Find::Rule)): `File::Find::Age->in($dir1,...
* [File::Find::Declare](https://metacpan.org/pod/File::Find::Declare) â `@paths = File::Find::Declare->new({ size => '>10K', perms => 'wr-wr-wr-', modified => '<2010-01-30', recurse => 1, dirs => [$dir1] })->find`.
* [File::Find::Iterator](https://metacpan.org/pod/File::Find::Iterator) â Ð¸Ð¼ÐµÐµÑ ÐÐРинÑеÑÑÐµÐ¹Ñ Ñ Ð¸ÑеÑаÑоÑом и ÑÑнкÑии `imap` и `igrep`.
* [File::Find::Match](https://metacpan.org/pod/File::Find::Match) â вÑзÑÐ²Ð°ÐµÑ Ð¾Ð±ÑабоÑÑик на каждÑй подоÑедÑий ÑилÑÑÑ. ÐоÑ
ож на `switch`.
* [File::Find::Node](https://metacpan.org/pod/File::Find::Node) â обÑ
Ð¾Ð´Ð¸Ñ Ð¸ÐµÑаÑÑ
Ð¸Ñ Ñайлов паÑаллелÑно неÑколÑкими пÑоÑеÑÑами: `tie @paths, IPC::Shareable, { key => "GLUE STRING", create => 1 }; F...
* [File::Find::Fast](https://metacpan.org/pod/File::Find::Fast) â `@paths = @{ find($dir) }`.
* [File::Find::Object](https://metacpan.org/pod/File::Find::Object) â Ð¸Ð¼ÐµÐµÑ ÐÐРинÑеÑÑÐµÐ¹Ñ Ñ Ð¸ÑеÑаÑоÑом.
* [File::Find::Parallel](https://metacpan.org/pod/File::Find::Parallel) â ÑÐ¼ÐµÐµÑ ÑÑавниваÑÑ Ð´Ð²Ð° каÑалога и возвÑаÑаÑÑ Ð¸Ñ
обÑединение, пеÑеÑеÑение и колиÑеÑÑвенное пеÑеÑ...
* [File::Find::Rex](https://metacpan.org/pod/File::Find::Rex) â `@paths = File::Find::Rex->new(recursive => 1, ignore_hidden => 1)->query($dir, qr/^b/i)`.
* [File::Find::Rule](https://metacpan.org/pod/File::Find::Rule) â `@files = File::Find::Rule->any( File::Find::Rule->file->name('*.mp3', '*.ogg')->size('>2M'), File::Find::Rule->empty )->in($dir1, $dir2);`. ÐÐ¼ÐµÐµÑ Ð¸ÑеÑаÑоÑ, пÑоÑед...
* [File::Find::Wanted](https://metacpan.org/pod/File::Find::Wanted) â `@paths = find_wanted( sub { -f && /\.png/ }, $dir )`.
* [File::Hotfolder](https://metacpan.org/pod/File::Hotfolder) â `watch( $dir, callback => sub { push @paths, shift } )->loop`. РабоÑÐ°ÐµÑ Ð½Ð° `AnyEvent`. ÐаÑÑÑаиваемÑй. ÐÑÑÑ ÑаÑпаÑаллеливание на неÑко...
* [File::Mirror](https://metacpan.org/pod/File::Mirror) â ÑоÑмиÑÑÐµÑ Ñак же паÑаллелÑнÑй пÑÑÑ Ð´Ð»Ñ ÐºÐ¾Ð¿Ð¸ÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ñайлов: `recursive { my ($src, $dst) = @_; push @paths, $src } '/path/A', '/path/B'`.
* [File::Set](https://metacpan.org/pod/File::Set) â `$fs = File::Set->new; $fs->add($dir); @paths = map { $_->[0] } $fs->get_path_list`.
* [File::Wildcard](https://metacpan.org/pod/File::Wildcard) â `$fw = File::Wildcard->new(exclude => qr/.svn/, case_insensitive => 1, sort => 1, path => "src///*.cpp", match => qr(^src/(.*?)\.cpp$), derive => ['src/$1.o','src/$1.hpp']); push @paths,...
* [File::Wildcard::Find](https://metacpan.org/pod/File::Wildcard::Find) â `findbegin($dir); push @paths, $f while $f = findnext()` или `findbegin($dir); @paths = findall()`.
* [File::Util](https://metacpan.org/pod/File::Util) â `File::Util->new->list_dir($dir, qw/ --pattern=\.txt$ --files-only --recurse /)`.
* [Mojo::File](https://metacpan.org/pod/Mojo::File) â `say for path($path)->list_tree({hidden => 1, dir => 1})->each`.
* [Path::Find](https://metacpan.org/pod/Path::Find) â `@paths = path_find( $dir, "*.png" )`. ÐÐ»Ñ ÑложнÑÑ
запÑоÑов иÑполÑзÑÐµÑ _matchable_: `my $sub = matchable( sub { my( $entry, $directory, $fullname, $depth ) = @_; $dep...
```
```perl
use lib "lib";
include("A")->new # ~> A=HASH\(0x\w+\)
[map include, qw/A N/] # --> [qw/A N/]
{ local $_="N"; include->ex } # -> 123
```
## catonce (;$file)
ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿Ð°ÐºÐµÑ Ð² пÑÑÑ Ð¤Ð¡. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
```perl
from_pkg "Aion::Fs" # => Aion/Fs.pm
[map from_pkg, "Aion::Fs", "A::B::C"] # --> ["Aion/Fs.pm", "A/B/C.pm"]
```
## to_pkg (;$path)
ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿ÑÑÑ Ð¸Ð· ФС в пакеÑ. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
```perl
to_pkg "Aion/Fs.pm" # => Aion::Fs
[map to_pkg, "Aion/Fs.md", "A/B/C.md"] # --> ["Aion::Fs", "A::B::C"]
```
## from_inc (;$pkg)
ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿Ð°ÐºÐµÑ Ð² пÑÑÑ Ð¤Ð¡ в `@INC`. Файл Ñ Ð¿Ð°ÐºÐµÑом должен ÑÑÑеÑÑвоваÑÑ Ð² одном из пÑÑей `@INC`. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
```perl
from_inc "Aion::Fs" # -> $INC{'Aion/Fs.pm'}
[map from_inc, "A::B::C", "Aion::Fs"] # --> [$INC{'Aion/Fs.pm'}]
from_inc "A::B::C" # -> undef
```
## to_inc (;$path)
ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿ÑÑÑ Ð¸Ð· ФС в `@INC` в пакеÑ. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
```perl
to_inc $INC{'Aion/Fs.pm'} # => Aion::Fs
[map to_inc,"A/B/C.pm", $INC{'Aion/Fs.pm'}] # --> ["Aion::Fs"]
to_inc 'Aion/Fs.pm' # -> undef
```
## ilay (;$path)
view all matches for this distribution