Aion-Fs
view release on metacpan or search on metacpan
```
ÐÑполÑзÑеÑÑÑ Ð² ÑилÑÑÑаÑ
ÑÑнкÑии `find`.
### See also
* [File::Wildcard](https://metacpan.org/pod/File::Wildcard).
* [String::Wildcard::Bash](https://metacpan.org/pod/String::Wildcard::Bash).
* [Text::Glob](https://metacpan.org/pod/Text::Glob) â `glob_to_regex("*.{pm,pl}")`.
## goto_editor ($path, $line)
ÐÑкÑÑÐ²Ð°ÐµÑ Ñайл в ÑедакÑоÑе из .config на Ñказанной ÑÑÑоке. Ðо ÑмолÑÐ°Ð½Ð¸Ñ Ð¸ÑполÑзÑÐµÑ `vscodium %p:%l`.
Файл .config.pm:
```perl
package config;
config_module 'Aion::Fs' => {
EDITOR => 'echo %p:%l > ed.txt',
};
1;
```
```perl
goto_editor "mypath", 10;
cat "ed.txt" # => mypath:10\n
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"]
```
lib/Aion/Fs.md view on Meta::CPAN
```
ÐÑполÑзÑеÑÑÑ Ð² ÑилÑÑÑаÑ
ÑÑнкÑии `find`.
### See also
* [File::Wildcard](https://metacpan.org/pod/File::Wildcard).
* [String::Wildcard::Bash](https://metacpan.org/pod/String::Wildcard::Bash).
* [Text::Glob](https://metacpan.org/pod/Text::Glob) â `glob_to_regex("*.{pm,pl}")`.
## goto_editor ($path, $line)
ÐÑкÑÑÐ²Ð°ÐµÑ Ñайл в ÑедакÑоÑе из .config на Ñказанной ÑÑÑоке. Ðо ÑмолÑÐ°Ð½Ð¸Ñ Ð¸ÑполÑзÑÐµÑ `vscodium %p:%l`.
Файл .config.pm:
```perl
package config;
config_module 'Aion::Fs' => {
EDITOR => 'echo %p:%l > ed.txt',
};
1;
```
```perl
goto_editor "mypath", 10;
cat "ed.txt" # => mypath:10\n
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"]
```
lib/Aion/Fs.pm view on Meta::CPAN
exists $+{w1}? "(":
exists $+{w2}? ")":
exists $+{comma}? "|":
quotemeta $&
}gxe;
qr/^$wildcard$/ns
}
# ÐÑкÑÑÐ²Ð°ÐµÑ Ñайл на Ñказанной ÑÑÑоке в ÑедакÑоÑе
use config EDITOR => "vscodium %p:%l";
sub goto_editor($$) {
my ($path, $line) = @_;
my $p = EDITOR;
$p =~ s!%p!$path!;
$p =~ s!%l!$line!;
my $status = system $p;
die "$path:$line --> $status" if $status;
return;
}
# Ðз пакеÑа в ÑайловÑй пÑÑÑ
lib/Aion/Fs.pm view on Meta::CPAN
=over
=item * L<File::Wildcard>.
=item * L<String::Wildcard::Bash>.
=item * L<Text::Glob> â C<glob_to_regex("*.{pm,pl}")>.
=back
=head2 goto_editor ($path, $line)
ÐÑкÑÑÐ²Ð°ÐµÑ Ñайл в ÑедакÑоÑе из .config на Ñказанной ÑÑÑоке. Ðо ÑмолÑÐ°Ð½Ð¸Ñ Ð¸ÑполÑзÑÐµÑ C<vscodium %p:%l>.
Файл .config.pm:
package config;
config_module 'Aion::Fs' => {
EDITOR => 'echo %p:%l > ed.txt',
};
1;
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)
t/aion/fs.t view on Meta::CPAN
#
# ÐÑполÑзÑеÑÑÑ Ð² ÑилÑÑÑаÑ
ÑÑнкÑии `find`.
#
# ### See also
#
# * [File::Wildcard](https://metacpan.org/pod/File::Wildcard).
# * [String::Wildcard::Bash](https://metacpan.org/pod/String::Wildcard::Bash).
# * [Text::Glob](https://metacpan.org/pod/Text::Glob) â `glob_to_regex("*.{pm,pl}")`.
#
# ## goto_editor ($path, $line)
#
# ÐÑкÑÑÐ²Ð°ÐµÑ Ñайл в ÑедакÑоÑе из .config на Ñказанной ÑÑÑоке. Ðо ÑмолÑÐ°Ð½Ð¸Ñ Ð¸ÑполÑзÑÐµÑ `vscodium %p:%l`.
#
# Файл .config.pm:
#@> .config.pm
#>> package config;
#>>
#>> config_module 'Aion::Fs' => {
#>> EDITOR => 'echo %p:%l > ed.txt',
#>> };
#>>
#>> 1;
#@< EOF
#
done_testing; }; subtest 'goto_editor ($path, $line)' => sub {
goto_editor "mypath", 10;
::is scalar do {cat "ed.txt"}, "mypath:10\n", 'cat "ed.txt" # => mypath:10\n';
::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"]';
( run in 0.261 second using v1.01-cache-2.11-cpan-de7293f3b23 )