vek has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed monks. I'm sure there is something extremely simple I'm missing here. I've had Apache::MP3 running on my desktop Linux box for ages. A co-worker recently expressed an interest and wanted me to install it on his Linux box. So, I downloaded the Apache/mod_perl source. Seemed to install fine, checked the SERVER_SOFTWARE ENV variable (via the vanilla printenv cgi script) after kicking off httpd:
SERVER_SOFTWARE="Apache/1.3.22 (Unix) mod_perl/1.26"
Then I installed Apache::MP3. Added the appropriate info to httpd.conf:
<Location /moozik> SetHandler perl-script PerlHandler Apache::MP3 </Location>
Restarted httpd for grins and proceeded to the .../moozik URL. Was promptly greeted with a nice 500 error. So off to the logs I went, and I found this little snippet of handy info:
[Tue Feb 26 16:02:54 2002] [error] Can't locate object method "new" vi +a package "Apache" at /usr/lib/perl5/site_perl/5.6.0/Apache/MP3.pm li +n 64.
What am I missing here? I'm sure I'll be kicking myself but I've tried re-installing everything from scratch and still no joy...

Replies are listed 'Best First'.
Re: Apache::MP3 Can't locate object method "new"
by LD2 (Curate) on Feb 27, 2002 at 06:06 UTC
    I may be incorrect here, but looking at the docs for Apache::MP3 - you need to use $response_code = handler($request) to create a new Apache::MP3 object. Straight from the documentation -
    $response_code = handler($request) This is a the standard mod_perl handler() subroutine. It creates a new + Apache::MP3 object, and then invokes its run() method.
      Yeh but that API doc is there in case you want to override Apache::MP3 methods isn't it? In fact the beauty of Apache::MP3 is that (previously in any case) you could use it 'right out of the box' which is why I think I'm missing something extremely simple here.
Re: Apache::MP3 Can't locate object method "new"
by perrin (Chancellor) on Feb 27, 2002 at 15:41 UTC
    You may have missed a step in the mod_perl install (did you do a 'make install' for both apache and mod_perl?), or you may have multiple apache servers on your system and this is the wrong one. You might also have compiled perl with a different compiler from the one you used for mod_perl. Finally, I suggest using a statically linked mod_perl because it seems to avoid a lot of possible traps.
      perrin++ thanks.

      Looks like perl was compiled with a different compiler perhaps. I re-installed perl and then proceeded with the same install of Apache/mod_perl/Apache::MP3 (same install procedure as yesterday). Works like a charm now.

      Thanks again.
(jeffa) Re: Apache::MP3 Can't locate object method "new"
by jeffa (Bishop) on Feb 27, 2002 at 15:42 UTC
    Is it possible that perhaps you have two versions of Perl on your system? If you installed Apache::MP3, then perhaps you installed it to a different distro than the one you used to compile mod_perl.

    Here is the http.conf directive that i use:

    Alias /mp3 /mnt/lump/mp3/ <Location /mp3> SetHandler perl-script PerlHandler Apache::MP3::Sorted PerlSetVar CacheDir /usr/tmp/mp3_cache PerlSetVar Fields title,filename,duration PerlSetVar PathStyle Arrows Order allow,deny Allow from all </Location>
    Good luck, and keep at it ... oh yeah, check out Apache Toolbox, it really makes installing mod_perl a breeze ;)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)