Aion-Fs
view release on metacpan or search on metacpan
t/aion/fs.t view on Meta::CPAN
#
# * `unlink` + `rmdir`.
# * [File::Path](https://metacpan.org/pod/File::Path) â `remove_tree("dir")`.
# * [File::Path::Tiny](https://metacpan.org/pod/File::Path::Tiny) â `File::Path::Tiny::rm($path)`. Ðе вÑбÑаÑÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑений.
# * [Mojo::File](https://metacpan.org/pod/Mojo::File) â `path($file)->remove`.
#
# ## replace (&sub, @files)
#
# ÐаменÑÐµÑ ÐºÐ°Ð¶Ð´Ñй Ñайл на `$_`, еÑли его изменÑÐµÑ `&sub`. ÐозвÑаÑÐ°ÐµÑ ÑайлÑ, в коÑоÑÑÑ
не бÑло замен.
#
# `@files` Ð¼Ð¾Ð¶ÐµÑ ÑодеÑжаÑÑ Ð¼Ð°ÑÑÐ¸Ð²Ñ Ð¸Ð· двÑÑ
ÑлеменÑов. ÐеÑвÑй ÑаÑÑмаÑÑиваеÑÑÑ ÐºÐ°Ðº пÑÑÑ, а вÑоÑой â как Ñлой. Слой по ÑмолÑÐ°Ð½Ð¸Ñ â `:utf8`.
#
# `&sub` вÑзÑваеÑÑÑ Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð³Ð¾ Ñайла из `@files`. Ð Ð½ÐµÑ Ð¿ÐµÑедаÑÑÑÑ:
#
# * `$_` â ÑодеÑжимое Ñайла.
# * `$a` â пÑÑÑ Ðº ÑайлÑ.
# * `$b` â Ñлой коÑоÑÑм бÑл ÑÑиÑан Ñайл и коÑоÑÑм он бÑÐ´ÐµÑ Ð·Ð°Ð¿Ð¸Ñан.
#
# РпÑимеÑе ниже Ñайл "replace.ex" ÑÑиÑÑваеÑÑÑ Ñлоем `:utf8`, а запиÑÑваеÑÑÑ Ñлоем `:raw` в ÑÑнкÑии `replace`:
#
::done_testing; }; subtest 'replace (&sub, @files)' => sub {
local $_ = "replace.ex";
lay "abc";
replace { $b = ":utf8"; y/a/¡/ } [$_, ":raw"];
local ($::_g0 = do {cat}, $::_e0 = "¡bc"); ::ok $::_g0 eq $::_e0, 'cat # => ¡bc' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ### See also
#
# * [File::Edit](https://metacpan.org/pod/File::Edit) â `File::Edit->new($file)->replace('x', 'y')->save`.
# * [File::Edit::Portable](https://metacpan.org/pod/File::Edit::Portable) â `File::Edit::Portable->new->splice(file => $file, line => 10, contens => ["line1", "line2"])`.
# * [File::Replace](https://metacpan.org/pod/File::Replace) â `($infh,$outfh,$repl) = replace3($file); while (<$infh>) { print $outfh "X: $_" } $repl->finish`.
# * [File::Replace::Inplace](https://metacpan.org/pod/File::Replace::Inplace).
#
# ## mkpath (;$path)
#
# Ðак **mkdir -p**, но ÑÑиÑÐ°ÐµÑ Ð¿Ð¾ÑледнÑÑ ÑаÑÑÑ Ð¿ÑÑи (поÑле поÑледней коÑой ÑеÑÑÑ) именем Ñайла и не ÑоздаÑÑ ÐµÑ ÐºÐ°Ñалогом. Ðез паÑамеÑÑа иÑполÑзÑ...
#
# * ÐÑли `$path` не Ñказан, иÑполÑзÑÐµÑ `$_`.
# * ÐÑли `$path` ÑвлÑеÑÑÑ ÑÑÑлкой на маÑÑив, Ñогда иÑполÑзÑеÑÑÑ Ð¿ÑÑÑ Ð² каÑеÑÑве пеÑвого ÑлеменÑа и пÑава в каÑеÑÑве вÑоÑого ÑлеменÑа.
# * ÐÑава по ÑмолÑÐ°Ð½Ð¸Ñ â `0755`.
# * ÐозвÑаÑÐ°ÐµÑ `$path`.
#
::done_testing; }; subtest 'mkpath (;$path)' => sub {
local $_ = ["A", 0755];
local ($::_g0 = do {mkpath}, $::_e0 = "A"); ::ok $::_g0 eq $::_e0, 'mkpath # => A' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
::like scalar do {eval { mkpath "/A/" }; $@}, qr{mkpath /A: Permission denied}, 'eval { mkpath "/A/" }; $@ # ~> mkpath /A: Permission denied'; undef $::_g0; undef $::_e0;
mkpath "A///./file";
local ($::_g0 = do {-d "A"}, $::_e0 = do {1}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '-d "A" # -> 1' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ### See also
#
# * [File::Path](https://metacpan.org/pod/File::Path) â `mkpath("dir1/dir2")`.
# * [File::Path::Tiny](https://metacpan.org/pod/File::Path::Tiny) â `File::Path::Tiny::mk($path)`. Ðе вÑбÑаÑÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑений.
#
# ## mtime (;$path)
#
# ÐÑÐµÐ¼Ñ Ð¼Ð¾Ð´Ð¸ÑикаÑии `$path` в unixtime Ñ Ð´Ñобной ÑаÑÑÑÑ (из `Time::HiRes::stat`). Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
# ÐÑбÑаÑÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑение, еÑли Ñайл не ÑÑÑеÑÑвÑÐµÑ Ð¸Ð»Ð¸ Ð½ÐµÑ Ð¿Ñав:
#
::done_testing; }; subtest 'mtime (;$path)' => sub {
local $_ = "nofile";
::like scalar do {eval { mtime }; $@}, qr{mtime nofile: No such file or directory}, 'eval { mtime }; $@ # ~> mtime nofile: No such file or directory'; undef $::_g0; undef $::_e0;
::like scalar do {mtime ["/"]}, qr{^\d+(\.\d+)?$}, 'mtime ["/"] # ~> ^\d+(\.\d+)?$'; undef $::_g0; undef $::_e0;
#
# ### See also
#
# * `-M` â `-M "file.txt"`, `-M _` в днÑÑ
Ð¾Ñ ÑекÑÑего вÑемени.
# * [stat](https://metacpan.org/pod/stat) â `(stat "file.txt")[9]` в ÑекÑндаÑ
(unixtime).
# * [Time::HiRes](https://metacpan.org/pod/Time::HiRes) â `(Time::HiRes::stat "file.txt")[9]` в ÑекÑндаÑ
Ñ Ð´Ñобной ÑаÑÑÑÑ.
# * [Mojo::File](https://metacpan.org/pod/Mojo::File) â `path($file)->stat->mtime`.
#
# ## sta (;$path)
#
# ÐозвÑаÑÐ°ÐµÑ ÑÑаÑиÑÑÐ¸ÐºÑ Ð¾ Ñайле. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
# ЧÑÐ¾Ð±Ñ Ð¼Ð¾Ð¶Ð½Ð¾ бÑло иÑполÑзоваÑÑ Ñ Ð´ÑÑгими ÑайловÑми ÑÑнкÑиÑми, Ð¼Ð¾Ð¶ÐµÑ Ð¿Ð¾Ð»ÑÑаÑÑ ÑÑÑÐ»ÐºÑ Ð½Ð° маÑÑив из коÑоÑого беÑÑÑ Ð¿ÐµÑвÑй ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð² каÑеÑÑ...
#
# ÐÑбÑаÑÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑение, еÑли Ñайл не ÑÑÑеÑÑвÑÐµÑ Ð¸Ð»Ð¸ Ð½ÐµÑ Ð¿Ñав:
#
::done_testing; }; subtest 'sta (;$path)' => sub {
local $_ = "nofile";
::like scalar do {eval { sta }; $@}, qr{sta nofile: No such file or directory}, 'eval { sta }; $@ # ~> sta nofile: No such file or directory'; undef $::_g0; undef $::_e0;
::like scalar do {sta(["/"])->{ino}}, qr{^\d+$}, 'sta(["/"])->{ino} # ~> ^\d+$'; undef $::_g0; undef $::_e0;
::like scalar do {sta(".")->{atime}}, qr{^\d+(\.\d+)?$}, 'sta(".")->{atime} # ~> ^\d+(\.\d+)?$'; undef $::_g0; undef $::_e0;
#
# ### See also
#
# * [Fcntl](https://metacpan.org/pod/Fcntl) â ÑодеÑÐ¶Ð¸Ñ ÐºÐ¾Ð½ÑÑанÑÑ Ð´Ð»Ñ ÑаÑÐ¿Ð¾Ð·Ð½Ð°Ð²Ð°Ð½Ð¸Ñ Ñежима.
# * [BSD::stat](https://metacpan.org/pod/BSD::stat) â дополниÑелÑно возвÑаÑÐ°ÐµÑ atime, ctime и mtime в наноÑекÑндаÑ
, Ñлаги полÑзоваÑÐµÐ»Ñ Ð¸ Ð½Ð¾Ð¼ÐµÑ Ð³ÐµÐ½ÐµÑаÑии Ñайла. ÐÐ¼ÐµÐµÑ ÐÐ...
# * [File::chmod](https://metacpan.org/pod/File::chmod) â `chmod("o=,g-w","file1","file2")`, `@newmodes = getchmod("+x","file1","file2")`.
# * [File::stat](https://metacpan.org/pod/File::stat) â пÑедоÑÑавлÑÐµÑ ÐÐÐ-инÑеÑÑÐµÐ¹Ñ Ðº stat.
# * [File::Stat::Bits](https://metacpan.org/pod/File::Stat::Bits) â аналогиÑен [Fcntl](https://metacpan.org/pod/Fcntl).
# * [File::stat::Extra](https://metacpan.org/pod/File::stat::Extra) â ÑаÑÑиÑÑÐµÑ [File::stat](https://metacpan.org/pod/File::stat) меÑодами Ð´Ð»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ Ð¸Ð½ÑоÑмаÑии о Ñежиме, а Ñак же пеÑезаÐ...
# * [File::Stat::Ls](https://metacpan.org/pod/File::Stat::Ls) â возвÑаÑÐ°ÐµÑ Ñежим в ÑоÑмаÑе ÑÑилиÑÑ ls.
# * [File::Stat::Moose](https://metacpan.org/pod/File::Stat::Moose) â ÐÐРинÑеÑÑÐµÐ¹Ñ Ð½Ð° Moose.
# * [File::Stat::OO](https://metacpan.org/pod/File::Stat::OO) â пÑедоÑÑавлÑÐµÑ ÐÐÐ-инÑеÑÑÐµÐ¹Ñ Ðº stat. ÐÐ¾Ð¶ÐµÑ Ð²Ð¾Ð·Ð²ÑаÑаÑÑ atime, ctime и mtime ÑÑÐ°Ð·Ñ Ð² `DateTime`.
# * [File::Stat::Trigger](https://metacpan.org/pod/File::Stat::Trigger) â Ñледилка за изменением аÑÑибÑÑов Ñайла.
# * [Linux::stat](https://metacpan.org/pod/Linux::stat) â паÑÑÐ¸Ñ /proc/stat и возвÑаÑÐ°ÐµÑ Ð´Ð¾Ð¿-инÑоÑмаÑиÑ. Ðднако в дÑÑгиÑ
ÐС не ÑабоÑаеÑ.
# * [Stat::lsMode](https://metacpan.org/pod/Stat::lsMode) â возвÑаÑÐ°ÐµÑ Ñежим в ÑоÑмаÑе ÑÑилиÑÑ ls.
# * [VMS::Stat](https://metacpan.org/pod/VMS::Stat) â возвÑаÑÐ°ÐµÑ ÑпиÑки VMS ACL.
#
# ## path (;$path)
#
# Ð Ð°Ð·Ð±Ð¸Ð²Ð°ÐµÑ ÑайловÑй пÑÑÑ Ð½Ð° ÑоÑÑавлÑÑÑие или ÑобиÑÐ°ÐµÑ ÐµÐ³Ð¾ из ÑоÑÑавлÑÑÑиÑ
.
#
# * ÐÑли полÑÑÐ°ÐµÑ ÑÑÑÐ»ÐºÑ Ð½Ð° маÑÑив, Ñо воÑпÑÐ¸Ð½Ð¸Ð¼Ð°ÐµÑ ÐµÐ³Ð¾ пеÑвÑй ÑÐ»ÐµÐ¼ÐµÐ½Ñ ÐºÐ°Ðº пÑÑÑ.
# * ÐÑли полÑÑÐ°ÐµÑ ÑÑÑÐ»ÐºÑ Ð½Ð° Ñ
ÑÑ, Ñо ÑобиÑÐ°ÐµÑ Ð¸Ð· него пÑÑÑ. ÐезнакомÑе клÑÑи пÑоÑÑо игноÑиÑÑеÑ. ÐÐ°Ð±Ð¾Ñ ÐºÐ»ÑÑей Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð¹ ФС â ÑазнÑй.
# * ФС беÑÑÑÑÑ Ð¸Ð· ÑиÑÑемной пеÑеменной `$^O`.
# * Ð Ñайловой ÑиÑÑеме не обÑаÑаеÑÑÑ.
#
::done_testing; }; subtest 'path (;$path)' => sub {
{
local $^O = "freebsd";
local ($::_g0 = do {path "."}, $::_e0 = do {{path => ".", file => ".", name => "."}}); ::is_deeply $::_g0, $::_e0, ' path "." # --> {path => ".", file => ".", name => "."}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e...
local ($::_g0 = do {path ".bashrc"}, $::_e0 = do {{path => ".bashrc", file => ".bashrc", name => ".bashrc"}}); ::is_deeply $::_g0, $::_e0, ' path ".bashrc" # --> {path => ".bashrc", file => ".bashrc", name => ".bashrc"}' or ::diag ::_struct_diff(...
local ($::_g0 = do {path ".bash.rc"}, $::_e0 = do {{path => ".bash.rc", file => ".bash.rc", name => ".bash", ext => "rc"}}); ::is_deeply $::_g0, $::_e0, ' path ".bash.rc" # --> {path => ".bash.rc", file => ".bash.rc", name => ".bash", ext => "rc"...
local ($::_g0 = do {path ["/"]}, $::_e0 = do {{path => "/", dir => "/"}}); ::is_deeply $::_g0, $::_e0, ' path ["/"] # --> {path => "/", dir => "/"}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local $_ = "";
local ($::_g0 = do {path}, $::_e0 = do {{path => ""}}); ::is_deeply $::_g0, $::_e0, ' path # --> {path => ""}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path "a/b/c.ext.ly"}, $::_e0 = do {{path => "a/b/c.ext.ly", dir => "a/b", file => "c.ext.ly", name => "c", ext => "ext.ly"}}); ::is_deeply $::_g0, $::_e0, ' path "a/b/c.ext.ly" # --> {path => "a/b/c.ext.ly", dir => "a/b", fil...
local ($::_g0 = do {path +{dir => "/", ext => "ext.ly"}}, $::_e0 = "/.ext.ly"); ::ok $::_g0 eq $::_e0, ' path +{dir => "/", ext => "ext.ly"} # => /.ext.ly' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{file => "b.c", ext => "ly"}}, $::_e0 = "b.ly"); ::ok $::_g0 eq $::_e0, ' path +{file => "b.c", ext => "ly"} # => b.ly' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{path => "a/b/f.c", dir => "m"}}, $::_e0 = "m/f.c"); ::ok $::_g0 eq $::_e0, ' path +{path => "a/b/f.c", dir => "m"} # => m/f.c' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
t/aion/fs.t view on Meta::CPAN
local ($::_g0 = do {path {volume => "ADFS::HardDisk.", file => "File"}}, $::_e0 = 'ADFS::HardDisk.File'); ::ok $::_g0 eq $::_e0, ' path {volume => "ADFS::HardDisk.", file => "File"} # \> ADFS::HardDisk.File' or ::diag ::_string_diff($::_g0, $::_e0...
local ($::_g0 = do {path {volume => "ADFS::HardDisk.", folder => '$', file => "File"}}, $::_e0 = 'ADFS::HardDisk.$.File'); ::ok $::_g0 eq $::_e0, ' path {volume => "ADFS::HardDisk.", folder => \'$\', file => "File"} # \> ADFS::HardDisk.$.File' or ...
local ($::_g0 = do {path {folder => "x"}}, $::_e0 = "x."); ::ok $::_g0 eq $::_e0, ' path {folder => "x"} # => x.' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path {dir => "x."}}, $::_e0 = "x."); ::ok $::_g0 eq $::_e0, ' path {dir => "x."} # => x.' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
}
{
local $^O = "MacOS";
my $path = {
path => '::::mix:report.doc',
dir => "::::mix:",
folder => ":::mix",
file => "report.doc",
name => "report",
ext => "doc",
};
local ($::_g0 = do {path $path->{path}}, $::_e0 = do {$path}); ::is_deeply $::_g0, $::_e0, ' path $path->{path} # --> $path' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path $path}, $::_e0 = "$path->{path}"); ::ok $::_g0 eq $::_e0, ' path $path # => $path->{path}' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path 'report'}, $::_e0 = do {{path => 'report', file => 'report', name => 'report'}}); ::is_deeply $::_g0, $::_e0, ' path \'report\' # --> {path => \'report\', file => \'report\', name => \'report\'}' or ::diag ::_struct_diff($...
local ($::_g0 = do {path {volume => "x", file => "f"}}, $::_e0 = "x:f"); ::ok $::_g0 eq $::_e0, ' path {volume => "x", file => "f"} # => x:f' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path {folder => "x"}}, $::_e0 = "x:"); ::ok $::_g0 eq $::_e0, ' path {folder => "x"} # => x:' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
}
{
local $^O = "vmesa";
my $path = {
path => ' USERID FILE EXT VOLUME ',
userid => "USERID",
file => "FILE EXT",
name => "FILE",
ext => "EXT",
volume => "VOLUME",
};
local ($::_g0 = do {path $path->{path}}, $::_e0 = do {$path}); ::is_deeply $::_g0, $::_e0, ' path $path->{path} # --> $path' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path {volume => "x", file => "f"}}, $::_e0 = do {' f x'}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, ' path {volume => "x", file => "f"} # -> \' f x\'' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0...
}
#
# ### See also
#
# * https://en.wikipedia.org/wiki/Path_(computing)
#
# ÐодÑли Ð´Ð»Ñ Ð¾Ð¿ÑÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ ÐС, а знаÑÐ¸Ñ Ð¸ опÑеделениÑ, какие в ÐС ÑайловÑе пÑÑи:
#
# * `$^O` â ÑÑпеÑглобалÑÐ½Ð°Ñ Ð¿ÐµÑÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ñ Ð½Ð°Ð·Ð²Ð°Ð½Ð¸ÐµÐ¼ ÑекÑÑей ÐС.
# * [Devel::CheckOS](https://metacpan.org/pod/Devel::CheckOS), [Perl::OSType](https://metacpan.org/pod/Perl::OSType) â опÑеделÑÑÑ ÐС.
# * [Devel::AssertOS](https://metacpan.org/pod/Devel::AssertOS) â запÑеÑÐ°ÐµÑ Ð¸ÑполÑзоваÑÑ Ð¼Ð¾Ð´ÑÐ»Ñ Ð²Ð½Ðµ ÑказаннÑÑ
ÐС.
# * [System::Info](https://metacpan.org/pod/System::Info) â инÑоÑмаÑÐ¸Ñ Ð¾Ð± ÐС, ÐµÑ Ð²ÐµÑÑии, диÑÑÑибÑÑиве, CPU и Ñ
оÑÑе.
#
# ÐÑделÑÑÑ ÑаÑÑи ÑайловÑÑ
пÑÑей:
#
# * [File::Spec](https://metacpan.org/pod/File::Spec) â `($volume, $directories, $file) = File::Spec->splitpath($path)`. ÐоддеÑÐ¶Ð¸Ð²Ð°ÐµÑ ÑолÑко unix, win32, os/2, vms, cygwin и amigaos.
# * [File::Spec::Functions](https://metacpan.org/pod/File::Spec::Functions) â `($volume, $directories, $file) = splitpath($path)`.
# * [File::Spec::Mac](https://metacpan.org/pod/File::Spec::Mac) â вÑ
Ð¾Ð´Ð¸Ñ Ð² [File::Spec](https://metacpan.org/pod/File::Spec), но не опÑеделÑеÑÑÑ Ð¸Ð¼, поÑÑÐ¾Ð¼Ñ Ð¿ÑиÑ
одиÑÑÑ Ð¸ÑполÑзоваÑÑ Ð¾ÑделÑÐ...
# * [File::Basename](https://metacpan.org/pod/File::Basename) â `($name, $path, $suffix) = fileparse($fullname, @suffixlist)`.
# * [Path::Class::File](https://metacpan.org/pod/Path::Class::File) â `file('foo', 'bar.txt')->is_absolute`.
# * [Path::Extended::File](https://metacpan.org/pod/Path::Extended::File) â `Path::Extended::File->new($file)->basename`.
# * [Mojo::File](https://metacpan.org/pod/Mojo::File) â `path($file)->extname`.
# * [Path::Util](https://metacpan.org/pod/Path::Util) â `$filename = basename($dir)`.
# * [Parse::Path](https://metacpan.org/pod/Parse::Path) â `Parse::Path->new(path => 'gophers[0].food.count', style => 'DZIL')->push("chunk")`. РабоÑÐ°ÐµÑ Ñ Ð¿ÑÑÑми как Ñ Ð¼Ð°ÑÑивами (`push`, `pop`, `shift`, `splice`). Так ...
#
# ## transpath ($path?, $from, $to)
#
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿ÑÑÑ Ð¸Ð· ÑоÑмаÑа одной ÐС в дÑÑгÑÑ.
#
# ÐÑли `$path` не Ñказан, Ñо иÑполÑзÑеÑÑÑ `$_`.
#
# ÐеÑеÑÐµÐ½Ñ Ð¿Ð¾Ð´Ð´ÐµÑживаемÑÑ
ÐС ÑмоÑÑиÑе в пÑимеÑаÑ
подпÑогÑÐ°Ð¼Ð¼Ñ `path` ÑÑÑÑ Ð²ÑÑе или Ñак: `keys %Aion::Fs::FS`.
#
# ÐÐ°Ð·Ð²Ð°Ð½Ð¸Ñ ÐС â ÑегиÑÑÑонезавиÑимÑ.
#
::done_testing; }; subtest 'transpath ($path?, $from, $to)' => sub {
local $_ = ">x>y>z.doc.zip";
local ($::_g0 = do {transpath "vos", "unix"}, $::_e0 = '/x/y/z.doc.zip'); ::ok $::_g0 eq $::_e0, 'transpath "vos", "unix" # \> /x/y/z.doc.zip' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {transpath "vos", "VMS"}, $::_e0 = '[.x.y]z.doc.zip'); ::ok $::_g0 eq $::_e0, 'transpath "vos", "VMS" # \> [.x.y]z.doc.zip' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {transpath $_, "vos", "RiscOS"}, $::_e0 = '.x.y.z/doc/zip'); ::ok $::_g0 eq $::_e0, 'transpath $_, "vos", "RiscOS" # \> .x.y.z/doc/zip' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
#
# ## splitdir (;$dir)
#
# Ð Ð°Ð·Ð±Ð¸Ð²Ð°ÐµÑ Ð´Ð¸ÑекÑоÑÐ¸Ñ Ð½Ð° ÑоÑÑавлÑÑÑие. ÐиÑекÑоÑÐ¸Ñ ÑледÑÐµÑ Ð²Ð½Ð°Ñале полÑÑиÑÑ Ð¸Ð· `path->{dir}`.
#
::done_testing; }; subtest 'splitdir (;$dir)' => sub {
local $^O = "unix";
local ($::_g0 = do {[ splitdir "/x/" ]}, $::_e0 = do {["", "x", ""]}); ::is_deeply $::_g0, $::_e0, '[ splitdir "/x/" ] # --> ["", "x", ""]' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## joindir (;$dirparts)
#
# ÐбÑединÑÐµÑ Ð´Ð¸ÑекÑоÑÐ¸Ñ Ð¸Ð· ÑоÑÑавлÑÑÑиÑ
. ÐаÑем полÑÑеннÑÑ Ð´Ð¸ÑекÑоÑÐ¸Ñ ÑледÑÐµÑ Ð²ÐºÐ»ÑÑиÑÑ Ð² `path +{dir => $dir}`.
#
::done_testing; }; subtest 'joindir (;$dirparts)' => sub {
local $^O = "unix";
local ($::_g0 = do {joindir qw/x y z/}, $::_e0 = "x/y/z"); ::ok $::_g0 eq $::_e0, 'joindir qw/x y z/ # => x/y/z' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{ dir => joindir qw/x y z/ }}, $::_e0 = "x/y/z/"); ::ok $::_g0 eq $::_e0, 'path +{ dir => joindir qw/x y z/ } # => x/y/z/' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## splitext (;$ext)
#
# Ð Ð°Ð·Ð±Ð¸Ð²Ð°ÐµÑ ÑаÑÑиÑение на ÑоÑÑавлÑÑÑие. РаÑÑиÑение ÑледÑÐµÑ Ð²Ð½Ð°Ñале полÑÑиÑÑ Ð¸Ð· `path->{ext}`.
#
::done_testing; }; subtest 'splitext (;$ext)' => sub {
local $^O = "unix";
local ($::_g0 = do {[ splitext ".x." ]}, $::_e0 = do {["", "x", ""]}); ::is_deeply $::_g0, $::_e0, '[ splitext ".x." ] # --> ["", "x", ""]' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## joinext (;$extparts)
#
# ÐбÑединÑÐµÑ ÑаÑÑиÑение из ÑоÑÑавлÑÑÑиÑ
. ÐаÑем полÑÑенное ÑаÑÑиÑение ÑледÑÐµÑ Ð²ÐºÐ»ÑÑиÑÑ Ð² `path +{ext => $ext}`.
#
::done_testing; }; subtest 'joinext (;$extparts)' => sub {
local $^O = "unix";
local ($::_g0 = do {joinext qw/x y z/}, $::_e0 = "x.y.z"); ::ok $::_g0 eq $::_e0, 'joinext qw/x y z/ # => x.y.z' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{ ext => joinext qw/x y z/ }}, $::_e0 = ".x.y.z"); ::ok $::_g0 eq $::_e0, 'path +{ ext => joinext qw/x y z/ } # => .x.y.z' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## include (;$pkg)
#
# ÐодклÑÑÐ°ÐµÑ `$pkg` (еÑли он еÑÑ Ð½Ðµ бÑл подклÑÑÑн ÑеÑез `use` или `require`) и возвÑаÑÐ°ÐµÑ ÐµÐ³Ð¾. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
# Файл lib/A.pm:
#@> lib/A.pm
#>> package A;
#>> sub new { bless {@_}, shift }
#>> 1;
#@< EOF
#
# Файл lib/N.pm:
#@> lib/N.pm
#>> package N;
#>> sub ex { 123 }
#>> 1;
#@< EOF
#
::done_testing; }; subtest 'include (;$pkg)' => sub {
use lib "lib";
::like scalar do {include("A")->new}, qr{A=HASH\(0x\w+\)}, 'include("A")->new # ~> A=HASH\(0x\w+\)'; undef $::_g0; undef $::_e0;
local ($::_g0 = do {[map include, qw/A N/]}, $::_e0 = do {[qw/A N/]}); ::is_deeply $::_g0, $::_e0, '[map include, qw/A N/] # --> [qw/A N/]' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {{ local $_="N"; include->ex }}, $::_e0 = do {123}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '{ local $_="N"; include->ex } # -> 123' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## catonce (;$file)
#
# СÑиÑÑÐ²Ð°ÐµÑ Ñайл в пеÑвÑй Ñаз. ÐÑÐ±Ð°Ñ Ð¿Ð¾ÑледÑÑÑÐ°Ñ Ð¿Ð¾Ð¿ÑÑка ÑÑиÑаÑÑ ÑÑÐ¾Ñ Ñайл возвÑаÑÐ°ÐµÑ `undef`. ÐÑполÑзÑеÑÑÑ Ð´Ð»Ñ Ð²ÑÑавки модÑлей js и css в ÑезÑÐ...
#
# * `$file` Ð¼Ð¾Ð¶ÐµÑ ÑодеÑжаÑÑ Ð¼Ð°ÑÑÐ¸Ð²Ñ Ð¸Ð· двÑÑ
ÑлеменÑов. ÐеÑвÑй ÑаÑÑмаÑÑиваеÑÑÑ ÐºÐ°Ðº пÑÑÑ, а вÑоÑой â как Ñлой. Слой по ÑмолÑÐ°Ð½Ð¸Ñ â `:utf8`.
# * ÐÑли `$file` не Ñказан â иÑполÑзÑÐµÑ `$_`.
#
::done_testing; }; subtest 'catonce (;$file)' => sub {
local $_ = "catonce.txt";
lay "result";
local ($::_g0 = do {catonce}, $::_e0 = do {"result"}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'catonce # -> "result"' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {catonce}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'catonce # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
::like scalar do {eval { catonce[] }; $@}, qr{catonce not use ref path\!}, 'eval { catonce[] }; $@ # ~> catonce not use ref path!'; undef $::_g0; undef $::_e0;
#
# ## wildcard (;$wildcard)
#
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ ÑайловÑÑ Ð¼Ð°ÑÐºÑ Ð² ÑегÑлÑÑное вÑÑажение. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
# * `**` - `[^/]*`
# * `*` - `.*`
# * `?` - `.`
# * `??` - `[^/]`
# * `{` - `(`
# * `}` - `)`
# * `,` - `|`
# * ÐÑÑалÑнÑе ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ ÑкÑаниÑÑÑÑÑÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ `quotemeta`.
#
::done_testing; }; subtest 'wildcard (;$wildcard)' => sub {
( run in 0.659 second using v1.01-cache-2.11-cpan-df04353d9ac )