Lincoln:

After a day of adding debug statements into Apache::MP3 and CGI.pm
I finally tracked down why my streaming was not working.  I had
listened to http://perl.apache.org/guide/performance.html#PerlSetupEnv_Off
which caused $ENV{QUERY_STRING} to not be set which broke CGI.pm.

To save others the agony, you might want to add a note to the Apache::MP3
docs that it requires "PerlSetupEnv on"

Alternatively, you might consider rewriting Apache::MP3 to use 
Apache::Request instead of CGI.pm (though I understand you may have 
a fondness for the latter).

I've included a patch to convert Apache::MP3 to use Apache::Request
for parameters.  More work would be required to convert the other uses 
of CGI.pm, but if you'd like, I'd be willing to tackle that, too, as 
it would be nice to not require the large size of CGI.pm.

Thanks
--
Eric Hammond
[EMAIL PROTECTED]

--- Apache/MP3.pm.orig  Sat Mar  2 18:00:37 2002
+++ Apache/MP3.pm       Sun Mar  3 10:14:23 2002
@@ -67,7 +67,7 @@
 
 sub new {
   my $class = shift;
-  unshift @_,'r' if @_ == 1;
+  @_ = ('r' => Apache::Request->new(shift)) if @_ == 1;
   return bless { @_ },$class;
 }
 
@@ -82,35 +82,35 @@
     if -d $r->filename;  # should be $r->finfo, but STILL problems with this
 
   #simple download of file
-  return $self->download_file($r->filename) unless param;
+  return $self->download_file($r->filename) unless $r->param;
 
   # this is called to stream a file
-  return $self->stream if param('stream');
+  return $self->stream if $r->param('stream');
 
   # this is called to generate a playlist on the current directory
   return $self->send_playlist($self->find_mp3s)
-    if param('Play All');
+    if $r->param('Play All');
 
   # this is called to generate a playlist on the current directory
   # and everything beneath
   return $self->send_playlist($self->find_mp3s('recursive')) 
-    if param('Play All Recursive') ;
+    if $r->param('Play All Recursive') ;
 
   # this is called to generate a shuffled playlist of current directory
   return $self->send_playlist($self->find_mp3s,'shuffle')
-    if param('Shuffle');
+    if $r->param('Shuffle');
 
   # this is called to generate a shuffled playlist of current directory
   return $self->send_playlist($self->find_mp3s,'shuffle')
-    if param('Shuffle All');
+    if $r->param('Shuffle All');
 
   # this is called to generate a shuffled playlist of current directory
   # and everything beneath
   return $self->send_playlist($self->find_mp3s('recursive'),'shuffle')
-    if param('Shuffle All Recursive');
+    if $r->param('Shuffle All Recursive');
 
   # this is called to generate a playlist for one file
-  if (param('play')) {
+  if ($r->param('play')) {
     my $dot3 = '.m3u|.pls';
     my($basename) = $r->uri =~ m!([^/]+?)($dot3)?$!;
     $basename = quotemeta($basename);
@@ -137,8 +137,8 @@
   }
 
   # this is called to generate a playlist for selected files
-  if (param('Play Selected')) {
-    return HTTP_NO_CONTENT unless my @files = param('file');
+  if ($r->param('Play Selected')) {
+    return HTTP_NO_CONTENT unless my @files = $r->param('file');
     my $uri = dirname($r->uri);
     $self->send_playlist([map { "$uri/$_" } @files]);
     return OK;

Reply via email to