Sunday, May 20, 2012

installing Perl module on dreamhost

K wanted me to include mp3 tags on the downloads at dl.radiosai.org. Googled installing Perl Module without root access, and found lots of people doing it, so went on to install MP3::Tag module without root access.

First I tried the procedure at
http://perl.jonallen.info/writing/articles/install-perl-modules-without-root
but the perl process kept getting killed as given at
http://wiki.dreamhost.com/Killed

Dreamhost recommends installing via the CPAN command, as given at
http://wiki.dreamhost.com/CPAN
and then the process doesn't get killed.

But the wiki had some bugs. Got errors like

Cannot gzopen $ENV{HOME}/.cpan/sources/authors etc. Googled it and found
http://discussion.dreamhost.com/thread-87436.html
where the user k2S explains that he did two things differently from the wiki page
http://wiki.dreamhost.com/CPAN
that is

**don't forget to add the suggested lines into your '~/.bash_profile' - that is, not ~/.profile
 ** test command 'echo $PERL5LIB', it should return the correct path

* *I had to edit also ~/.cpan/CPAN/MyConfig.pm and replace all '$ENV{HOME}' with the correct path

Once I did this, the install worked fine, with perl -MMP3::Tag -e 1 not returning any errors.
 (I had actually done the manual config of the MyConfig.pm  as given in the wiki, too.)

After the module installation, some trial scripts still gave errors. Trying out a basic script from

http://search.cpan.org/~ilyaz/MP3-Tag-0.9709/Tag.pm
got errors like
Can't call method "get_tags" on an undefined value

Found this explanation, that it is because the file has no tag to begin with:
http://www.linuxquestions.org/questions/programming-9/cant-call-method-title-on-undefined-title-in-perl-script-396858/

Then tried tagging the file with no tag to start with, and got errors like:
Can't call method "new_tag" on unblessed reference at ./mp3tagger.pl line 6.

Problem was - the filename has to have the full path, and not start with ~/
Once that was done, the script worked. Now to work out some sort of tagging scheme, after which the tagging can be done.

No comments:

Post a Comment