?¡ëPNG
IHDR ? f ??C1 sRGB ??¨¦ gAMA ¡À?¨¹a pHYs ? ??o¡§d GIDATx^¨ª¨¹L¡±¡Âe¡ÂY?a?("Bh?_¨°???¡é¡ì?q5k?*:t0A-o??£¤]VkJ¡éM??f?¡À8\k2¨ªll¡ê1]q?¨´???T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
package Filter::Simple;
use Text::Balanced ':ALL';
use vars qw{ $VERSION @EXPORT };
$VERSION = '0.84';
use Filter::Util::Call;
use Carp;
@EXPORT = qw( FILTER FILTER_ONLY );
sub import {
if (@_>1) { shift; goto &FILTER }
else { *{caller()."::$_"} = \&$_ foreach @EXPORT }
}
sub fail {
croak "FILTER_ONLY: ", @_;
}
my $exql = sub {
my @bits = extract_quotelike $_[0], qr//;
return unless $bits[0];
return \@bits;
};
my $ncws = qr/\s+/;
my $comment = qr/(? [ $ws, \&extract_variable, $id, { MATCH => \&extract_quotelike } ],
regex => [ $ws, $pod_or_DATA, $id, $exql ],
string => [ $ws, $pod_or_DATA, $id, $exql ],
code => [ $ws, { DONT_MATCH => $pod_or_DATA },
\&extract_variable,
$id, { DONT_MATCH => \&extract_quotelike } ],
code_no_comments
=> [ { DONT_MATCH => $comment },
$ncws, { DONT_MATCH => $pod_or_DATA },
\&extract_variable,
$id, { DONT_MATCH => \&extract_quotelike } ],
executable => [ $ws, { DONT_MATCH => $pod_or_DATA } ],
executable_no_comments
=> [ { DONT_MATCH => $comment },
$ncws, { DONT_MATCH => $pod_or_DATA } ],
all => [ { MATCH => qr/(?s:.*)/ } ],
);
my %selector_for = (
all => sub { my ($t)=@_; sub{ $_=$$_; $t->(@_); $_} },
executable=> sub { my ($t)=@_; sub{ref() ? $_=$$_ : $t->(@_); $_} },
quotelike => sub { my ($t)=@_; sub{ref() && do{$_=$$_; $t->(@_)}; $_} },
regex => sub { my ($t)=@_;
sub{ref() or return $_;
my ($ql,undef,$pre,$op,$ld,$pat) = @$_;
return $_->[0] unless $op =~ /^(qr|m|s)/
|| !$op && ($ld eq '/' || $ld eq '?');
$_ = $pat;
$t->(@_);
$ql =~ s/^(\s*\Q$op\E\s*\Q$ld\E)\Q$pat\E/$1$_/;
return "$pre$ql";
};
},
string => sub { my ($t)=@_;
sub{ref() or return $_;
local *args = \@_;
my ($pre,$op,$ld1,$str1,$rd1,$ld2,$str2,$rd2,$flg) = @{$_}[2..10];
return $_->[0] if $op =~ /^(qr|m)/
|| !$op && ($ld1 eq '/' || $ld1 eq '?');
if (!$op || $op eq 'tr' || $op eq 'y') {
local *_ = \$str1;
$t->(@args);
}
if ($op =~ /^(tr|y|s)/) {
local *_ = \$str2;
$t->(@args);
}
my $result = "$pre$op$ld1$str1$rd1";
$result .= $ld2 if $ld1 =~ m/[[({<]/; #])}>
$result .= "$str2$rd2$flg";
return $result;
};
},
);
sub gen_std_filter_for {
my ($type, $transform) = @_;
return sub {
my $instr;
local @components;
for (extract_multiple($_,$extractor_for{$type})) {
if (ref()) { push @components, $_; $instr=0 }
elsif ($instr) { $components[-1] .= $_ }
else { push @components, $_; $instr=1 }
}
if ($type =~ /^code/) {
my $count = 0;
local $placeholder = qr/\Q$;\E(\C{4})\Q$;\E/;
my $extractor = qr/\Q$;\E(\C{4})\Q$;\E/;
$_ = join "",
map { ref $_ ? $;.pack('N',$count++).$; : $_ }
@components;
@components = grep { ref $_ } @components;
$transform->(@_);
s/$extractor/${$components[unpack('N',$1)]}/g;
}
else {
my $selector = $selector_for{$type}->($transform);
$_ = join "", map $selector->(@_), @components;
}
}
};
sub FILTER (&;$) {
my $caller = caller;
my ($filter, $terminator) = @_;
no warnings 'redefine';
*{"${caller}::import"} = gen_filter_import($caller,$filter,$terminator);
*{"${caller}::unimport"} = gen_filter_unimport($caller);
}
sub FILTER_ONLY {
my $caller = caller;
while (@_ > 1) {
my ($what, $how) = splice(@_, 0, 2);
fail "Unknown selector: $what"
unless exists $extractor_for{$what};
fail "Filter for $what is not a subroutine reference"
unless ref $how eq 'CODE';
push @transforms, gen_std_filter_for($what,$how);
}
my $terminator = shift;
my $multitransform = sub {
foreach my $transform ( @transforms ) {
$transform->(@_);
}
};
no warnings 'redefine';
*{"${caller}::import"} =
gen_filter_import($caller,$multitransform,$terminator);
*{"${caller}::unimport"} = gen_filter_unimport($caller);
}
my $ows = qr/(?:[ \t]+|#[^\n]*)*/;
sub gen_filter_import {
my ($class, $filter, $terminator) = @_;
my %terminator;
my $prev_import = *{$class."::import"}{CODE};
return sub {
my ($imported_class, @args) = @_;
my $def_terminator =
qr/^(?:\s*no\s+$imported_class\s*;$ows|__(?:END|DATA)__)\r?$/;
if (!defined $terminator) {
$terminator{terminator} = $def_terminator;
}
elsif (!ref $terminator || ref $terminator eq 'Regexp') {
$terminator{terminator} = $terminator;
}
elsif (ref $terminator ne 'HASH') {
croak "Terminator must be specified as scalar or hash ref"
}
elsif (!exists $terminator->{terminator}) {
$terminator{terminator} = $def_terminator;
}
filter_add(
sub {
my ($status, $lastline);
my $count = 0;
my $data = "";
while ($status = filter_read()) {
return $status if $status < 0;
if ($terminator{terminator} &&
m/$terminator{terminator}/) {
$lastline = $_;
last;
}
$data .= $_;
$count++;
$_ = "";
}
return $count if not $count;
$_ = $data;
$filter->($imported_class, @args) unless $status < 0;
if (defined $lastline) {
if (defined $terminator{becomes}) {
$_ .= $terminator{becomes};
}
elsif ($lastline =~ $def_terminator) {
$_ .= $lastline;
}
}
return $count;
}
);
if ($prev_import) {
goto &$prev_import;
}
elsif ($class->isa('Exporter')) {
$class->export_to_level(1,@_);
}
}
}
sub gen_filter_unimport {
my ($class) = @_;
return sub {
filter_del();
goto &$prev_unimport if $prev_unimport;
}
}
1;
__END__
=head1 NAME
Filter::Simple - Simplified source filtering
=head1 SYNOPSIS
# in MyFilter.pm:
package MyFilter;
use Filter::Simple;
FILTER { ... };
# or just:
#
# use Filter::Simple sub { ... };
# in user's code:
use MyFilter;
# this code is filtered
no MyFilter;
# this code is not
=head1 DESCRIPTION
=head2 The Problem
Source filtering is an immensely powerful feature of recent versions of Perl.
It allows one to extend the language itself (e.g. the Switch module), to
simplify the language (e.g. Language::Pythonesque), or to completely recast the
language (e.g. Lingua::Romana::Perligata). Effectively, it allows one to use
the full power of Perl as its own, recursively applied, macro language.
The excellent Filter::Util::Call module (by Paul Marquess) provides a
usable Perl interface to source filtering, but it is often too powerful
and not nearly as simple as it could be.
To use the module it is necessary to do the following:
=over 4
=item 1.
Download, build, and install the Filter::Util::Call module.
(If you have Perl 5.7.1 or later, this is already done for you.)
=item 2.
Set up a module that does a C