App-CPAN2Pkg
view release on metacpan or search on metacpan
lib/App/CPAN2Pkg/UI/Text.pm view on Meta::CPAN
=head2 log_err
=head2 log_comment
=head2 log_result
=head2 log_step
log_XXX( $module, $line )
Log a C<$line> of output / stderr / comment / result / step in
C<$module> tab.
=head2 module_state
module_state( $module )
Sent from the controller when a module has changed status (either
local or upstream).
=head2 new_module
lib/App/CPAN2Pkg/UI/Tk.pm view on Meta::CPAN
=head2 log_err
=head2 log_comment
=head2 log_result
=head2 log_step
log_XXX( $module, $line )
Log a C<$line> of output / stderr / comment / result / step in
C<$module> tab.
=head2 module_state
module_state( $module )
Sent from the controller when a module has changed status (either
local or upstream).
=head2 new_module
lib/App/CPAN2Pkg/Worker.pm view on Meta::CPAN
sub run_command {
my ($self, $cmd, $event) = @_;
$K->post( main => log_comment => $self->module->name => "Running: $cmd\n" );
$ENV{LC_ALL} = 'C';
my $child = POE::Wheel::Run->new(
Program => $cmd,
Conduit => "pty-pipe",
StdoutEvent => "_child_stdout",
StderrEvent => "_child_stderr",
CloseEvent => "_child_close",
);
$K->sig_child( $child->PID, "_child_signal" );
$self->_set_wheel( $child );
$self->_clear_output;
$self->_set_result_event( $event );
#print( "Child pid ", $child->PID, " started as wheel ", $child->ID, ".\n" );
}
event _child_stdout => sub {
my ($self, $line, $wid) = @_[OBJECT, ARG0, ARG1];
$self->_add_output( "$line\n" );
$K->post( main => log_out => $self->module->name => $line );
};
event _child_stderr => sub {
my ($self, $line, $wid) = @_[OBJECT, ARG0, ARG1];
$K->post( main => log_err => $self->module->name => $line );
};
event _child_close => sub {
my ($self, $wid) = @_[OBJECT, ARG0];
#say "child closed all pipes";
};
event _child_signal => sub {
t/00-compile.t view on Meta::CPAN
use File::Spec;
use IPC::Open3;
use IO::Handle;
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");
if (@_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
}
}
foreach my $file (@scripts)
{ 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");
# 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)
{
warn @_warnings;
push @warnings, @_warnings;
}
( run in 0.671 second using v1.01-cache-2.11-cpan-49f99fa48dc )