App-after
view release on metacpan or search on metacpan
#sub init {
# my $self = shift;
# if ( exists $self->{log_level} ) {
# $self->{log_level} = Log::Any::Adapter::Util::numeric_level( $self->{log_level} )
# unless $self->{log_level} =~ /^\d+$/;
# }
# else {
# $self->{log_level} = $trace_level;
# }
# my $file = $self->{file};
# my $binmode ||= ':utf8';
# $binmode = ":$binmode" unless substr($binmode,0,1) eq ':';
# open( $self->{fh}, ">>$binmode", $file )
# or die "cannot open '$file' for append: $!";
# $self->{fh}->autoflush(1);
#}
#
#foreach my $method ( Log::Any::Adapter::Util::logging_methods() ) {
# no strict 'refs';
# my $method_level = Log::Any::Adapter::Util::numeric_level( $method );
# *{$method} = sub {
# my ( $self, $text ) = @_;
# return if $method_level > $self->{log_level};
{
my $fres;
my $save_res; if (exists $_pci_r->{res}[3]{"cmdline.result"}) { $save_res = $_pci_r->{res}[2]; $_pci_r->{res}[2] = $_pci_r->{res}[3]{"cmdline.result"} }
my $is_success = $_pci_r->{res}[0] =~ /\A2/ || $_pci_r->{res}[0] == 304;
my $is_stream = $_pci_r->{res}[3]{stream} // undef // 0;
if ($is_success && (0 || $_pci_r->{res}[3]{"cmdline.skip_format"})) { $fres = $_pci_r->{res}[2] }
elsif ($is_success && $is_stream) {}
else { require Local::_pci_clean_json; require Perinci::Result::Format::Lite; $is_stream=0; _pci_clean_json($_pci_r->{res}); $fres = Perinci::Result::Format::Lite::format($_pci_r->{res}, ($_pci_r->{format} // $_pci_r->{res}[3]{"cmdline.default_format...
my $use_utf8 = $_pci_r->{res}[3]{"x.hint.result_binary"} ? 0 : 0;
if ($use_utf8) { binmode STDOUT, ":utf8" }
if ($is_stream) {
my $code = $_pci_r->{res}[2]; if (ref($code) ne "CODE") { die "Result is a stream but no coderef provided" } if (0) { while(defined(my $l=$code->())) { print $l; print "\n" unless "" eq "buf"; } } else { while (defined(my $rec=$code->())) { print...
} else {
print $fres;
}
if (defined $save_res) { $_pci_r->{res}[2] = $save_res }
}
### exit
t/00-compile.t view on Meta::CPAN
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { require blib; blib->VERSION('1.01') };
if (@_warnings)
{
warn @_warnings;
t/00-compile.t view on Meta::CPAN
{ SKIP: {
open my $fh, '<', $file or warn("Unable to open $file: $!"), next;
my $line = <$fh>;
close $fh and skip("$file isn't perl", 1) unless $line =~ /^#!\s*(?:\S*perl\S*)((?:\s+-\w*)*)(?:\s*#.*)?$/;
my @flags = $1 ? split(' ', $1) : ();
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, @flags, '-c', $file);
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$file compiled ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { require blib; blib->VERSION('1.01') };
# in older perls, -c output is simply the file portion of the path being tested
if (@_warnings = grep { !/\bsyntax OK$/ }
grep { chomp; $_ ne (File::Spec->splitpath($file))[2] } @_warnings)
( run in 0.443 second using v1.01-cache-2.11-cpan-4e96b696675 )