[boulder.pm] A challenge

Robert L. Harris Robert.L.Harris at rdlg.net
Tue Mar 12 12:04:30 CST 2002



Last time I was told I gave too much info.  I'll keep it short but
attach the file though in hopes.

Here is the offending code:  (please excuse if this is "sloppy" as it's
a first attempt at something like this.)

sub ProcessPipe {
  my ($sel) = new IO::Select( \*READER );
  my ($Read, $handle);
  my ($Loop)="T";
  
  while(@PipeReady = $sel->can_read(1)) {
    foreach $FileHandle (@PipeReady) {
    print "\$FileHandle :$FileHandle:\n";
      if ($FileHandle == \*READER) {
	# We have something to read
        print "We have something to read!\n" if ($Verbose eq "T");
        @LinesFromReader=(\*READER);
        print "\@LinesFromReader :@LinesFromReader\n" if ($Verbose eq "T");
        foreach $handle ( @LinesFromReader ) {
          while($Loop eq "T") {
            chomp($Read=<$handle>);
            next if ($Read =~ /^$/);
            print "\$Read :$Read:\n" if ($Verbose eq "T");
            $Loop=&HandleRead($Read);
          }
          # $sel->remove(\*READER) if eof(\*READER);
          last unless $sel->handles;
        }
      }
      sleep 3;
    }
  }
}

What is happening,  I have a while loop running that runs until all the
songs are riped from CD and encoded.  Once per loop it executes this sub
proc.  It should grab song names from the forked children of what has
been ripped and then tell the script it has a new song to encode.  At
current I seem to be getting stuck in this loop and it continuously
prints out the "We have something to read" followed by the LinesFromReader
 and the "Read" line meaning it has valid information in the pipe, but
it doesn't deem to be popping it off the pipe and continueing.  Some
times it'll go through a whole CD, sometimes it starts it's fatal loop
after the first song is ripped.

If I uncomment the line: # $sel->remove(\*READER) if eof(\*READER);
The code blows and exits.


Please feel free to suggest changes, but give a "why" so I can learn.
If anyone comes up with suggestions I'll be happy to put in a Credits
section, etc.

Thanks to those who will help.





Thus spake Walter Pienciak (walter at frii.com):

> On Sun, 10 Mar 2002, Robert L. Harris wrote:
> 
> >
> > I've put together a forking mp3 encoder that uses bladeenc and
> > cdparanoia.  It works pretty well except for some oddity in the IPC
> > code.  Haven't found any good examples to work off recently.
> >
> > I'm gonna list it on sourceforge and open it, but while I'm waiting on
> > the site to be set up, etc, I'm wondering if anyone would like to help
> > try and clean up the IPC block or anything else they want to dig into.
> 
> If you can provide some detail as to the IPC "oddity", and the relevant
> code, maybe someone might see something while they're reading their
> e-mail and drinking their coffee.
> 
> Walter



:wq!
---------------------------------------------------------------------------
Robert L. Harris                |  Micros~1 :  
Senior System Engineer          |    For when quality, reliability 
  at RnD Consulting             |      and security just aren't
                                \_       that important!
DISCLAIMER:
      These are MY OPINIONS ALONE.  I speak for no-one else.
FYI:
 perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'

-------------- next part --------------
A non-text attachment was scrubbed...
Name: EncodeIt.tar.bz2
Type: application/octet-stream
Size: 4401 bytes
Desc: not available
Url : http://mail.pm.org/archives/boulder-pm/attachments/20020312/b52fb346/EncodeIt.tar.obj


More information about the Boulder-pm mailing list