Kristofer Wolff wrote:
> use IPC::Open2;
> $pid = open2(\*r, \*w, 'l3dec', '-sti', '-.sto', '-ff', '-sa');
> print w "n\n"; # its for the non-registration-version.
> open(MP3, "<test.mp3");
Always check your opens. Did this even succeed? (For that matter, did the
open2 succeed? But then, if it bombs, it die()s with a message matching
/^open2:/.)
> do
> {
> $mpreader = sysread(MP3, $uncomp, 512);
> print ".";
> print w "$uncomp";
You probably need binmode on the r, w, and MP3 file handles.
> while(<r>)
> {
> print "e";
> }
Does l3dec produce outputs separated by newlines? I would have thought it'd
produce binary data. (Oh yes, you said it's WAV format.)
So instead of <r>, you probably want read() (or sysread, if you want) to
read a chunk at a time.
> } while($mpreader > 0);
> close($pid);
This is probably wrong. $pid is not a filehandle. Did you mean waitpid, as
suggested in `perldoc IPC::Open2?
> exit;
And think about buffering. Maybe l3dec wants more than 512 bytes before it
starts producing output -- then your <r> (or read()) would block since
you're waiting for l3dec to produce output, and l3dec blocks waiting for
more input from you. Make sure you synchronise correctly. Otherwise, bingo
-- deadlock.
Cheers,
Philip
--
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web