App-after

 view release on metacpan or  search on metacpan

bin/_after  view on Meta::CPAN

3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
#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};

bin/after  view on Meta::CPAN

213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
{
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

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ 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.305 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )