App-MaMGal

 view release on metacpan or  search on metacpan

lib/App/MaMGal/MplayerWrapper.pm  view on Meta::CPAN

	my $self = shift;
	my $film_path = shift;
	my $dir = $self->{tempdir};
	my $pid = fork;
	if (not defined $pid) {
		App::MaMGal::MplayerWrapper::ExecutionFailureException->throw("Fork failed: $!");
	} elsif ($pid == 0) {
		# Child
		open(STDOUT, ">${dir}/stdout") or App::MaMGal::MplayerWrapper::ExecutionFailureException->throw("Cannot open \"${dir}/stdout\" for writing: $!");
		open(STDERR, ">${dir}/stderr") or App::MaMGal::MplayerWrapper::ExecutionFailureException->throw("Cannot open \"${dir}/stderr\" for writing: $!");
		my @cmd = ('mplayer', $film_path, '-noautosub', '-nosound', '-vo', "jpeg:quality=100:outdir=${dir}", '-frames', '2');
		{ # own scope to prevent a compile-time warning
		exec(@cmd);
		}
		App::MaMGal::MplayerWrapper::ExecutionFailureException->throw("Cannot run mplayer: $!");
	} else {
		# Parent
		waitpid($pid, 0);
		App::MaMGal::MplayerWrapper::ExecutionFailureException->throw("Mplayer failed ($?).", $self->_read_messages) if $? != 0;
	}
}

t/README  view on Meta::CPAN

  complicated).

  Additionally, having the biggest integration test execute as last, makes it
  easy to visually inspect the program behaviour in a relatively interesting
  use case.

  Therefore we have a naming convention which makes the unit tests run before
  all other tests. Also, integration tests which use less classes should be put
  before those which use more classes, if possible.

  Ordering is possible because the perl testing framework runs them in filename
  alphabetical order.

Notes
-----

Things to keep in mind when changing/adding tests:
 - they should succeed in any timezone and any locale: you can check that by
   running for example:

   LANG=C TZ=GMT make test



( run in 0.595 second using v1.01-cache-2.11-cpan-e1769b4cff6 )