Aion-Fs
view release on metacpan or search on metacpan
СÑиÑÑÐ²Ð°ÐµÑ Ñайл. ÐÑли паÑамеÑÑ Ð½Ðµ Ñказан, иÑполÑзÑÐµÑ `$_`.
```perl
cat "/etc/passwd" # ~> root
```
`cat` ÑиÑÐ°ÐµÑ Ñо Ñлоем `:utf8`. Ðо можно ÑказаÑÑ Ð´ÑÑгой Ñлой ÑледÑÑÑим обÑазом:
```perl
lay "unicode.txt", "â¯";
length cat "unicode.txt" # -> 1
length cat["unicode.txt", ":raw"] # -> 3
```
`cat` вÑзÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑение в ÑлÑÑае оÑибки опеÑаÑии ввода-вÑвода:
```perl
eval { cat "A" }; $@ # ~> cat A: No such file or directory
```
### See also
lib/Aion/Fs.md view on Meta::CPAN
СÑиÑÑÐ²Ð°ÐµÑ Ñайл. ÐÑли паÑамеÑÑ Ð½Ðµ Ñказан, иÑполÑзÑÐµÑ `$_`.
```perl
cat "/etc/passwd" # ~> root
```
`cat` ÑиÑÐ°ÐµÑ Ñо Ñлоем `:utf8`. Ðо можно ÑказаÑÑ Ð´ÑÑгой Ñлой ÑледÑÑÑим обÑазом:
```perl
lay "unicode.txt", "â¯";
length cat "unicode.txt" # -> 1
length cat["unicode.txt", ":raw"] # -> 3
```
`cat` вÑзÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑение в ÑлÑÑае оÑибки опеÑаÑии ввода-вÑвода:
```perl
eval { cat "A" }; $@ # ~> cat A: No such file or directory
```
### See also
lib/Aion/Fs.pm view on Meta::CPAN
if($+{open}) {
my $group = $+{group};
if ($group && @S) {
my $curgroup;
for(my $i = $#S; $i>=0; --$i) { $curgroup = $S[$i][1], last if defined $S[$i][1] }
$_->{remove}{$curgroup}{$group}++ if defined $curgroup;
}
push @S, [length($`) + length $&, $group];
}
elsif($+{close}) {
my ($pos, $group, $g2) = @{pop @S};
$S[$#S][2] //= $group if $_->{group}{$group} && @S;
$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} }
lib/Aion/Fs.pm view on Meta::CPAN
=head2 cat ($file)
Reads the file. If no parameter is specified, use C<$_>.
cat "/etc/passwd" # ~> root
C<cat> reads with layer C<:utf8>. But you can specify another layer like this:
lay "unicode.txt", "â¯";
length cat "unicode.txt" # -> 1
length cat["unicode.txt", ":raw"] # -> 3
C<cat> throws an exception if the I/O operation fails:
eval { cat "A" }; $@ # ~> cat A: No such file or directory
=head3 See also
=over
=item * L<autodie> â C<< open $f, "r.txt"; $s = join "", E<lt>$fE<gt>; close $f >>.
t/aion/fs.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Fs - ÑÑилиÑÑ Ð´Ð»Ñ Ñайловой ÑиÑÑемÑ: ÑÑение, запиÑÑ, поиÑк, замена Ñайлов и Ñ.д.
#
# # VERSION
#
# 0.2.2
#
# # SYNOPSIS
#
t/aion/fs.t view on Meta::CPAN
# СÑиÑÑÐ²Ð°ÐµÑ Ñайл. ÐÑли паÑамеÑÑ Ð½Ðµ Ñказан, иÑполÑзÑÐµÑ `$_`.
#
::done_testing; }; subtest 'cat ($file)' => sub {
::like scalar do {cat "/etc/passwd"}, qr{root}, 'cat "/etc/passwd" # ~> root'; undef $::_g0; undef $::_e0;
#
# `cat` ÑиÑÐ°ÐµÑ Ñо Ñлоем `:utf8`. Ðо можно ÑказаÑÑ Ð´ÑÑгой Ñлой ÑледÑÑÑим обÑазом:
#
lay "unicode.txt", "â¯";
local ($::_g0 = do {length cat "unicode.txt"}, $::_e0 = do {1}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'length cat "unicode.txt" # -> 1' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {length cat["unicode.txt", ":raw"]}, $::_e0 = do {3}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'length cat["unicode.txt", ":raw"] # -> 3' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# `cat` вÑзÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑение в ÑлÑÑае оÑибки опеÑаÑии ввода-вÑвода:
#
::like scalar do {eval { cat "A" }; $@}, qr{cat A: No such file or directory}, 'eval { cat "A" }; $@ # ~> cat A: No such file or directory'; undef $::_g0; undef $::_e0;
#
# ### See also
#
t/aion/fs/cat.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
#
# Aion::Fs::Cat - ÑайловÑй деÑкÑипÑÐ¾Ñ Ñ Ð°Ð²ÑозакÑÑÑием
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Fs qw/lay/;
use Aion::Fs::Cat;
use Symbol;
t/aion/fs/find.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Fs::Find - иÑеÑаÑÐ¾Ñ Ð¿Ð¾Ð¸Ñка Ñайлов Ð´Ð»Ñ Aion::Fs#find
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Fs::Find;
my $iter = Aion::Fs::Find->new(
t/aion/fs/lay.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
#
# Aion::Fs::Lay - ÑайловÑй деÑкÑипÑÐ¾Ñ Ñ Ð°Ð²ÑозакÑÑÑием
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Fs::Lay;
use Symbol;
my $file = "lay.test.txt";
( run in 1.415 second using v1.01-cache-2.11-cpan-5b529ec07f3 )