view release on metacpan or search on metacpan
```perl
use Aion::Fs;
lay mkpath "hello/world.txt", "hi!";
lay mkpath "hello/moon.txt", "noreplace";
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 $_: $!" };
\@noreplaced # --> ["hello/moon.txt"]
cat "hello/world.txt" # => hello/world.txt :utf8 Hi!
cat "hello/moon.txt" # => noreplace
mkpath for qw!ex/1/11 ex/1/12 ex/2/21 ex/2/22!;
my $count = 0;
find "ex", sub { find_stop if ++$count == 3; 1} # -> 2
```
### 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::Random](https://metacpan.org/pod/File::Find::Random) â вÑбиÑÐ°ÐµÑ Ñайл или диÑекÑоÑÐ¸Ñ Ð½Ð°Ñгад из иеÑаÑÑ
ии Ñайлов.
* [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...
* [Path::Extended::Dir](https://metacpan.org/pod/Path::Extended::Dir) â `@paths = Path::Extended::Dir->new($dir)->find('*.txt')`.
* [Path::Iterator::Rule](https://metacpan.org/pod/Path::Iterator::Rule) â `$i = Path::Iterator::Rule->new->file; @paths = $i->clone->size(">10k")->all(@dirs); $i->size("<10k")...`.
* [Path::Class::Each](https://metacpan.org/pod/Path::Class::Each) â `dir($dir)->each(sub { push @paths, "$_" })`.
* [Path::Class::Iterator](https://metacpan.org/pod/Path::Class::Iterator) â `$i = Path::Class::Iterator->new(root => $dir, depth => 2); until ($i->done) { push @paths, $i->next->stringify }`.
* [Path::Class::Rule](https://metacpan.org/pod/Path::Class::Rule) â `@paths = Path::Class::Rule->new->file->size(">10k")->all($dir)`.
Файл lib/N.pm:
```perl
package N;
sub ex { 123 }
1;
```
```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)
СÑиÑÑÐ²Ð°ÐµÑ Ñайл в пеÑвÑй Ñаз. ÐÑÐ±Ð°Ñ Ð¿Ð¾ÑледÑÑÑÐ°Ñ Ð¿Ð¾Ð¿ÑÑка ÑÑиÑаÑÑ ÑÑÐ¾Ñ Ñайл возвÑаÑÐ°ÐµÑ `undef`. ÐÑполÑзÑеÑÑÑ Ð´Ð»Ñ Ð²ÑÑавки модÑлей js и css в ÑезÑлÑ...
* `$file` Ð¼Ð¾Ð¶ÐµÑ ÑодеÑжаÑÑ Ð¼Ð°ÑÑÐ¸Ð²Ñ Ð¸Ð· двÑÑ
ÑлеменÑов. ÐеÑвÑй ÑаÑÑмаÑÑиваеÑÑÑ ÐºÐ°Ðº пÑÑÑ, а вÑоÑой â как Ñлой. Слой по ÑмолÑÐ°Ð½Ð¸Ñ â `:utf8`.
* ÐÑли `$file` не Ñказан â иÑполÑзÑÐµÑ `$_`.
eval { goto_editor "`", 1 }; $@ # ~> `:1 --> 512
```
## from_pkg (;$pkg)
ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿Ð°ÐºÐµÑ Ð² пÑÑÑ Ð¤Ð¡. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
```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"]
```
# AUTHOR
Yaroslav O. Kosmina <dart@cpan.org>
# LICENSE
â **GPLv3**
lib/Aion/Fs.md view on Meta::CPAN
```perl
use Aion::Fs;
lay mkpath "hello/world.txt", "hi!";
lay mkpath "hello/moon.txt", "noreplace";
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 $_: $!" };
\@noreplaced # --> ["hello/moon.txt"]
cat "hello/world.txt" # => hello/world.txt :utf8 Hi!
cat "hello/moon.txt" # => noreplace
lib/Aion/Fs.md view on Meta::CPAN
mkpath for qw!ex/1/11 ex/1/12 ex/2/21 ex/2/22!;
my $count = 0;
find "ex", sub { find_stop if ++$count == 3; 1} # -> 2
```
### 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::Random](https://metacpan.org/pod/File::Find::Random) â вÑбиÑÐ°ÐµÑ Ñайл или диÑекÑоÑÐ¸Ñ Ð½Ð°Ñгад из иеÑаÑÑ
ии Ñайлов.
* [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...
* [Path::Extended::Dir](https://metacpan.org/pod/Path::Extended::Dir) â `@paths = Path::Extended::Dir->new($dir)->find('*.txt')`.
* [Path::Iterator::Rule](https://metacpan.org/pod/Path::Iterator::Rule) â `$i = Path::Iterator::Rule->new->file; @paths = $i->clone->size(">10k")->all(@dirs); $i->size("<10k")...`.
* [Path::Class::Each](https://metacpan.org/pod/Path::Class::Each) â `dir($dir)->each(sub { push @paths, "$_" })`.
* [Path::Class::Iterator](https://metacpan.org/pod/Path::Class::Iterator) â `$i = Path::Class::Iterator->new(root => $dir, depth => 2); until ($i->done) { push @paths, $i->next->stringify }`.
* [Path::Class::Rule](https://metacpan.org/pod/Path::Class::Rule) â `@paths = Path::Class::Rule->new->file->size(">10k")->all($dir)`.
lib/Aion/Fs.md view on Meta::CPAN
Файл lib/N.pm:
```perl
package N;
sub ex { 123 }
1;
```
```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)
СÑиÑÑÐ²Ð°ÐµÑ Ñайл в пеÑвÑй Ñаз. ÐÑÐ±Ð°Ñ Ð¿Ð¾ÑледÑÑÑÐ°Ñ Ð¿Ð¾Ð¿ÑÑка ÑÑиÑаÑÑ ÑÑÐ¾Ñ Ñайл возвÑаÑÐ°ÐµÑ `undef`. ÐÑполÑзÑеÑÑÑ Ð´Ð»Ñ Ð²ÑÑавки модÑлей js и css в ÑезÑлÑ...
* `$file` Ð¼Ð¾Ð¶ÐµÑ ÑодеÑжаÑÑ Ð¼Ð°ÑÑÐ¸Ð²Ñ Ð¸Ð· двÑÑ
ÑлеменÑов. ÐеÑвÑй ÑаÑÑмаÑÑиваеÑÑÑ ÐºÐ°Ðº пÑÑÑ, а вÑоÑой â как Ñлой. Слой по ÑмолÑÐ°Ð½Ð¸Ñ â `:utf8`.
* ÐÑли `$file` не Ñказан â иÑполÑзÑÐµÑ `$_`.
lib/Aion/Fs.md view on Meta::CPAN
eval { goto_editor "`", 1 }; $@ # ~> `:1 --> 512
```
## from_pkg (;$pkg)
ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿Ð°ÐºÐµÑ Ð² пÑÑÑ Ð¤Ð¡. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
```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"]
```
# AUTHOR
Yaroslav O. Kosmina <dart@cpan.org>
# LICENSE
â **GPLv3**
lib/Aion/Fs.pm view on Meta::CPAN
delete @res{keys %{$fs->{remove}->{$_}}} for @remove;
return %res, %$_;
}
sub _join(@) {
my ($match, @format) = @_;
my $fs = _fs;
my $trans = $fs->{before_split} // sub {$_[0]};
my %f = _match $match, $fs;
join "", List::Util::pairmap {
my @keys = ref $a? @$a: $a;
my $is = List::Util::first {defined $f{$_}} @keys;
defined $is? do {
my ($if, $format) = ref $b? @$b: (undef, $b);
my @val = map $trans->($f{$_}), @keys;
defined $if && $val[0] eq $if? $if:
$format !~ /%s/? $format:
sprintf($format, @val)
}: ()
} @format
}
# СинÑакÑиÑÑ ÑайловÑÑ
пÑÑей в ÑазнÑÑ
ÐС
my %FS;
my @FS = (
lib/Aion/Fs.pm view on Meta::CPAN
\z!xsn,
join => sub {
_join [qw/path/],
[qw/userid file ext volume/] => "%s %s %s %s",
},
},
);
# ÐниÑиализаÑÐ¸Ñ Ð¿Ð¾ имени
%FS = map {
$_->{symdirquote} = quotemeta $_->{symdir};
$_->{symextquote} = quotemeta $_->{symext};
my @S;
while($_->{regexp} =~ m{
\\ .
| (?<open> \( ( \?<(?<group> \w+ )> )? )
| (?<close> \) )
}gx) {
if($+{open}) {
lib/Aion/Fs.pm view on Meta::CPAN
$group //= $g2;
$_->{group}{$group} = do {
my $x = substr $_->{regexp}, $pos, length($`) - $pos;
qr/()^$x\z/xsn
} if defined $group;
}
}
my $x = $_;
ref $_->{name}? (map { ($_ => $x) } @{$_->{name}}): ($_->{name} => $_)
} @FS;
sub _fs() { $FS{lc $^O} // $FS{unix} }
# ÐÑ Ð½Ð°Ñ
одимÑÑ Ð² ÐС ÑемейÑÑва UNIX
sub isUNIX() { _fs->{name} eq "unix" }
# Ð Ð°Ð·Ð±Ð¸Ð²Ð°ÐµÑ Ð´Ð¸ÑекÑоÑÐ¸Ñ Ð½Ð° ÑоÑÑавлÑÑÑие
sub splitdir(;$) {
my ($dir) = @_ == 0? $_: @_;
lib/Aion/Fs.pm view on Meta::CPAN
if(ref $path eq "HASH") {
local $_ = $path;
return $fs->{join}->();
}
($path) = @$path if ref $path;
$path = $fs->{before_split}->($path) if exists $fs->{before_split};
+{
$path =~ $fs->{regexp}? (map { $_ ne "ext" && $+{$_} eq ""? (): ($_ => $+{$_}) } keys %+): (error => 1),
path => $path,
}
}
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿ÑÑÑ Ð¸Ð· ÑоÑмаÑа одной ÐС в дÑÑгÑÑ
sub transpath ($$;$) {
my ($path, $from, $to) = @_ == 2? ($_, @_): @_;
my (@dir, @folder, @ext);
{ local $^O = $from;
$path = path $path;
lib/Aion/Fs.pm view on Meta::CPAN
# group_can_exec group_can_read group_can_write
# other_can_exec other_can_read other_can_write
# /} = (
#
# );
\%sta
}
# ФайловÑе ÑилÑÑÑÑ
sub _filters(@) {
map {
if(ref $_ eq "CODE") {$_}
elsif(ref $_ eq "Regexp") { my $re = $_; sub { $_ =~ $re } }
elsif(/^-([a-z]+)$/) {
eval join "", "sub { ", (join " && ", map "-$_()", split //, $1), " }"
}
else { my $re = wildcard(); sub { $_ =~ $re } }
} @_
}
# ÐайÑи ÑайлÑ
sub find(;@) {
my $file = @_? shift: $_;
$file = [$file] unless ref $file;
lib/Aion/Fs.pm view on Meta::CPAN
use Aion::Fs;
lay mkpath "hello/world.txt", "hi!";
lay mkpath "hello/moon.txt", "noreplace";
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 $_: $!" };
\@noreplaced # --> ["hello/moon.txt"]
cat "hello/world.txt" # => hello/world.txt :utf8 Hi!
cat "hello/moon.txt" # => noreplace
lib/Aion/Fs.pm view on Meta::CPAN
find "ex", sub { find_stop if ++$count == 3; 1} # -> 2
=head3 See also
=over
=item * L<AudioFile::Find> â иÑÐµÑ Ð°ÑдиоÑÐ°Ð¹Ð»Ñ Ð² Ñказанной диÑекÑоÑии. ÐозволÑÐµÑ ÑилÑÑÑоваÑÑ Ð¸Ñ
по аÑÑибÑÑам: названиÑ, аÑÑиÑÑÑ, жанÑÑ, алÑÐ±Ð¾Ð¼Ñ Ð¸ ÑÑÑкÑ...
=item * L<Directory::Iterator> â C<< $it = Directory::Iterator-E<gt>new($dir, %opts); push @paths, $_ while E<lt>$itE<gt> >>.
=item * L<IO::All> â C<< @paths = map { "$_" } grep { -f $_ && $_-E<gt>size E<gt> 10*1024 } io(".")-E<gt>all(0) >>.
=item * L<IO::All::Rule> â C<< $next = IO::All::Rule-E<gt>new-E<gt>file-E<gt>size("E<gt>10k")-E<gt>iter($dir1, $dir2); push @paths, "$f" while $f = $next-E<gt>() >>.
=item * L<File::Find> â C<find( sub { push @paths, $File::Find::name if /\.png/ }, $dir )>.
=item * L<File::Find::utf8> â как L<File::Find>, ÑолÑко пÑÑи Ñайлов в I<utf8>.
=item * L<File::Find::Age> â ÑоÑÑиÑÑÐµÑ ÑÐ°Ð¹Ð»Ñ Ð¿Ð¾ вÑемени модиÑикаÑии (наÑледÑÐµÑ L<File::Find::Rule>): C<< File::Find::Age-E<gt>in($dir1, $dir2) >>.
=item * L<File::Find::Declare> â C<< @paths = File::Find::Declare-E<gt>new({ size =E<gt> 'E<gt>10K', perms =E<gt> 'wr-wr-wr-', modified =E<gt> 'E<lt>2010-01-30', recurse =E<gt> 1, dirs =E<gt> [$dir1] })-E<gt>find >>.
=item * L<File::Find::Iterator> â Ð¸Ð¼ÐµÐµÑ ÐÐРинÑеÑÑÐµÐ¹Ñ Ñ Ð¸ÑеÑаÑоÑом и ÑÑнкÑии C<imap> и C<igrep>.
=item * L<File::Find::Match> â вÑзÑÐ²Ð°ÐµÑ Ð¾Ð±ÑабоÑÑик на каждÑй подоÑедÑий ÑилÑÑÑ. ÐоÑ
ож на C<switch>.
=item * L<File::Find::Node> â обÑ
Ð¾Ð´Ð¸Ñ Ð¸ÐµÑаÑÑ
Ð¸Ñ Ñайлов паÑаллелÑно неÑколÑкими пÑоÑеÑÑами: C<< tie @paths, IPC::Shareable, { key =E<gt> "GLUE STRING", create =E<gt> 1 }; File::Find::Node-E<gt>new(...
=item * L<File::Find::Fast> â C<@paths = @{ find($dir) }>.
=item * L<File::Find::Object> â Ð¸Ð¼ÐµÐµÑ ÐÐРинÑеÑÑÐµÐ¹Ñ Ñ Ð¸ÑеÑаÑоÑом.
=item * L<File::Find::Parallel> â ÑÐ¼ÐµÐµÑ ÑÑавниваÑÑ Ð´Ð²Ð° каÑалога и возвÑаÑаÑÑ Ð¸Ñ
обÑединение, пеÑеÑеÑение и колиÑеÑÑвенное пеÑеÑеÑение.
lib/Aion/Fs.pm view on Meta::CPAN
=item * L<File::Find::Rex> â C<< @paths = File::Find::Rex-E<gt>new(recursive =E<gt> 1, ignore_hidden =E<gt> 1)-E<gt>query($dir, qr/^b/i) >>.
=item * L<File::Find::Rule> â C<< @files = File::Find::Rule-E<gt>any( File::Find::Rule-E<gt>file-E<gt>name('*.mp3', '*.ogg')-E<gt>size('E<gt>2M'), File::Find::Rule-E<gt>empty )-E<gt>in($dir1, $dir2); >>. ÐÐ¼ÐµÐµÑ Ð¸ÑеÑаÑоÑ, пÑоÑедÑÑ...
=item * L<File::Find::Wanted> â C<@paths = find_wanted( sub { -f && /\.png/ }, $dir )>.
=item * L<File::Hotfolder> â C<< watch( $dir, callback =E<gt> sub { push @paths, shift } )-E<gt>loop >>. РабоÑÐ°ÐµÑ Ð½Ð° C<AnyEvent>. ÐаÑÑÑаиваемÑй. ÐÑÑÑ ÑаÑпаÑаллеливание на неÑколÑко пÑоÑеÑ...
=item * L<File::Mirror> â ÑоÑмиÑÑÐµÑ Ñак же паÑаллелÑнÑй пÑÑÑ Ð´Ð»Ñ ÐºÐ¾Ð¿Ð¸ÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ñайлов: C<recursive { my ($src, $dst) = @_; push @paths, $src } '/path/A', '/path/B'>.
=item * L<File::Set> â C<< $fs = File::Set-E<gt>new; $fs-E<gt>add($dir); @paths = map { $_-E<gt>[0] } $fs-E<gt>get_path_list >>.
=item * L<File::Wildcard> â C<< $fw = File::Wildcard-E<gt>new(exclude =E<gt> qr/.svn/, case_insensitive =E<gt> 1, sort =E<gt> 1, path =E<gt> "src///*.cpp", match =E<gt> qr(^src/(.*?)\.cpp$), derive =E<gt> ['src/$1.o','src/$1.hpp']); push @paths, $f...
=item * L<File::Wildcard::Find> â C<findbegin($dir); push @paths, $f while $f = findnext()> или C<findbegin($dir); @paths = findall()>.
=item * L<File::Util> â C<< File::Util-E<gt>new-E<gt>list_dir($dir, qw/ --pattern=\.txt$ --files-only --recurse /) >>.
=item * L<Mojo::File> â C<< say for path($path)-E<gt>list_tree({hidden =E<gt> 1, dir =E<gt> 1})-E<gt>each >>.
=item * L<Path::Find> â C<@paths = path_find( $dir, "*.png" )>. ÐÐ»Ñ ÑложнÑÑ
запÑоÑов иÑполÑзÑÐµÑ I<matchable>: C<< my $sub = matchable( sub { my( $entry, $directory, $fullname, $depth ) = @_; $depth E<lt>= 3 } >>.
lib/Aion/Fs.pm view on Meta::CPAN
Файл lib/N.pm:
package N;
sub ex { 123 }
1;
use lib "lib";
include("A")->new # ~> A=HASH\(0x\w+\)
[map include, qw/A N/] # --> [qw/A N/]
{ local $_="N"; include->ex } # -> 123
=head2 catonce (;$file)
СÑиÑÑÐ²Ð°ÐµÑ Ñайл в пеÑвÑй Ñаз. ÐÑÐ±Ð°Ñ Ð¿Ð¾ÑледÑÑÑÐ°Ñ Ð¿Ð¾Ð¿ÑÑка ÑÑиÑаÑÑ ÑÑÐ¾Ñ Ñайл возвÑаÑÐ°ÐµÑ C<undef>. ÐÑполÑзÑеÑÑÑ Ð´Ð»Ñ Ð²ÑÑавки модÑлей js и css в ÑезÑл...
=over
=item * C<$file> Ð¼Ð¾Ð¶ÐµÑ ÑодеÑжаÑÑ Ð¼Ð°ÑÑÐ¸Ð²Ñ Ð¸Ð· двÑÑ
ÑлеменÑов. ÐеÑвÑй ÑаÑÑмаÑÑиваеÑÑÑ ÐºÐ°Ðº пÑÑÑ, а вÑоÑой â как Ñлой. Слой по ÑмолÑÐ°Ð½Ð¸Ñ â C<:utf8>.
lib/Aion/Fs.pm view on Meta::CPAN
goto_editor "mypath", 10;
cat "ed.txt" # => mypath:10\n
eval { goto_editor "`", 1 }; $@ # ~> `:1 --> 512
=head2 from_pkg (;$pkg)
ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿Ð°ÐºÐµÑ Ð² пÑÑÑ Ð¤Ð¡. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ C<$_>.
from_pkg "Aion::Fs" # => Aion/Fs.pm
[map from_pkg, "Aion::Fs", "A::B::C"] # --> ["Aion/Fs.pm", "A/B/C.pm"]
=head2 to_pkg (;$path)
ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿ÑÑÑ Ð¸Ð· ФС в пакеÑ. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ C<$_>.
to_pkg "Aion/Fs.pm" # => Aion::Fs
[map to_pkg, "Aion/Fs.md", "A/B/C.md"] # --> ["Aion::Fs", "A::B::C"]
=head1 AUTHOR
Yaroslav O. Kosmina L<mailto:dart@cpan.org>
=head1 LICENSE
â B<GPLv3>
=head1 COPYRIGHT
t/aion/fs.t view on Meta::CPAN
subtest 'SYNOPSIS' => sub {
use Aion::Fs;
lay mkpath "hello/world.txt", "hi!";
lay mkpath "hello/moon.txt", "noreplace";
lay mkpath "hello/big/world.txt", "hellow!";
lay mkpath "hello/small/world.txt", "noenter";
::like scalar do {mtime "hello"}, qr!^\d+(\.\d+)?$!, 'mtime "hello" # ~> ^\d+(\.\d+)?$';
::is_deeply scalar do {[map cat, grep -f, find ["hello/big", "hello/small"]]}, scalar do {[qw/ hellow! noenter /]}, '[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 $_: $!" };
::is_deeply scalar do {\@noreplaced}, scalar do {["hello/moon.txt"]}, '\@noreplaced # --> ["hello/moon.txt"]';
::is scalar do {cat "hello/world.txt"}, "hello/world.txt :utf8 Hi!", 'cat "hello/world.txt" # => hello/world.txt :utf8 Hi!';
::is scalar do {cat "hello/moon.txt"}, "noreplace", 'cat "hello/moon.txt" # => noreplace';
t/aion/fs.t view on Meta::CPAN
mkpath for qw!ex/1/11 ex/1/12 ex/2/21 ex/2/22!;
my $count = 0;
::is scalar do {find "ex", sub { find_stop if ++$count == 3; 1}}, scalar do{2}, 'find "ex", sub { find_stop if ++$count == 3; 1} # -> 2';
#
# ### 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($dir...
# * [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 };...
# * [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::Random](https://metacpan.org/pod/File::Find::Random) â вÑбиÑÐ°ÐµÑ Ñайл или диÑекÑоÑÐ¸Ñ Ð½Ð°Ñгад из иеÑаÑÑ
ии Ñайлов.
# * [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 @path...
# * [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 ) = @_; $d...
# * [Path::Extended::Dir](https://metacpan.org/pod/Path::Extended::Dir) â `@paths = Path::Extended::Dir->new($dir)->find('*.txt')`.
# * [Path::Iterator::Rule](https://metacpan.org/pod/Path::Iterator::Rule) â `$i = Path::Iterator::Rule->new->file; @paths = $i->clone->size(">10k")->all(@dirs); $i->size("<10k")...`.
# * [Path::Class::Each](https://metacpan.org/pod/Path::Class::Each) â `dir($dir)->each(sub { push @paths, "$_" })`.
# * [Path::Class::Iterator](https://metacpan.org/pod/Path::Class::Iterator) â `$i = Path::Class::Iterator->new(root => $dir, depth => 2); until ($i->done) { push @paths, $i->next->stringify }`.
# * [Path::Class::Rule](https://metacpan.org/pod/Path::Class::Rule) â `@paths = Path::Class::Rule->new->file->size(">10k")->all($dir)`.
t/aion/fs.t view on Meta::CPAN
# Файл 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+\)';
::is_deeply scalar do {[map include, qw/A N/]}, scalar do {[qw/A N/]}, '[map include, qw/A N/] # --> [qw/A N/]';
::is scalar do {{ local $_="N"; include->ex }}, scalar do{123}, '{ local $_="N"; include->ex } # -> 123';
#
# ## catonce (;$file)
#
# СÑиÑÑÐ²Ð°ÐµÑ Ñайл в пеÑвÑй Ñаз. ÐÑÐ±Ð°Ñ Ð¿Ð¾ÑледÑÑÑÐ°Ñ Ð¿Ð¾Ð¿ÑÑка ÑÑиÑаÑÑ ÑÑÐ¾Ñ Ñайл возвÑаÑÐ°ÐµÑ `undef`. ÐÑполÑзÑеÑÑÑ Ð´Ð»Ñ Ð²ÑÑавки модÑлей js и css в ÑезÑÐ...
#
# * `$file` Ð¼Ð¾Ð¶ÐµÑ ÑодеÑжаÑÑ Ð¼Ð°ÑÑÐ¸Ð²Ñ Ð¸Ð· двÑÑ
ÑлеменÑов. ÐеÑвÑй ÑаÑÑмаÑÑиваеÑÑÑ ÐºÐ°Ðº пÑÑÑ, а вÑоÑой â как Ñлой. Слой по ÑмолÑÐ°Ð½Ð¸Ñ â `:utf8`.
# * ÐÑли `$file` не Ñказан â иÑполÑзÑÐµÑ `$_`.
#
t/aion/fs.t view on Meta::CPAN
::like scalar do {eval { goto_editor "`", 1 }; $@}, qr!`:1 --> 512!, 'eval { goto_editor "`", 1 }; $@ # ~> `:1 --> 512';
#
# ## from_pkg (;$pkg)
#
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿Ð°ÐºÐµÑ Ð² пÑÑÑ Ð¤Ð¡. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
done_testing; }; subtest 'from_pkg (;$pkg)' => sub {
::is scalar do {from_pkg "Aion::Fs"}, "Aion/Fs.pm", 'from_pkg "Aion::Fs" # => Aion/Fs.pm';
::is_deeply scalar do {[map from_pkg, "Aion::Fs", "A::B::C"]}, scalar do {["Aion/Fs.pm", "A/B/C.pm"]}, '[map from_pkg, "Aion::Fs", "A::B::C"] # --> ["Aion/Fs.pm", "A/B/C.pm"]';
#
# ## to_pkg (;$path)
#
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿ÑÑÑ Ð¸Ð· ФС в пакеÑ. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
done_testing; }; subtest 'to_pkg (;$path)' => sub {
::is scalar do {to_pkg "Aion/Fs.pm"}, "Aion::Fs", 'to_pkg "Aion/Fs.pm" # => Aion::Fs';
::is_deeply scalar do {[map to_pkg, "Aion/Fs.md", "A/B/C.md"]}, scalar do {["Aion::Fs", "A::B::C"]}, '[map to_pkg, "Aion/Fs.md", "A/B/C.md"] # --> ["Aion::Fs", "A::B::C"]';
#
# # AUTHOR
#
# Yaroslav O. Kosmina <dart@cpan.org>
#
# # LICENSE
#
# â **GPLv3**
#