in reply to Re: using CPAN through web
in thread using CPAN through web

Hello,

Here is the script:

#!/usr/bin/perl use strict; use warnings; use CGI; use CPAN; use CPAN::Config; $CPAN::Config->{'build_dir'} = q[/home/rohan/.cpan/build]; $CPAN::Config->{'cpan_home'} = q[/home/rohan/.cpan]; $CPAN::Config->{'histfile'} = q[/home/rohan/.cpan/histfile]; $CPAN::Config->{'keep_source_where'} = q[/home/rohan/.cpan/sources]; $CPAN::Config->{'makepl_arg'} = q[PREFIX=/home/rohan/perllib LIB=home/ +rohan/perllib/lib/pe rl5]; my $q = CGI->new; print $q->header("text/plain"); CPAN::Shell->install("MP3::Tag");

Both, /home/rohan/.cpan and /home/rohan/perllib are owned and writable by user apache.

This is the output on the browser:

CPAN: Storable loaded ok
Going to read /home/rohan/.cpan2/Metadata
  Database was generated on Tue, 29 Mar 2005 09:53:28 GMT
Running install for module MP3::Tag
Running make for I/IL/ILYAZ/modules/MP3-Tag-0.94.tar.gz
CPAN: Digest::MD5 loaded ok
Checksum for /home/rohan/.cpan2/sources/authors/id/I/IL/ILYAZ/modules/MP3-Tag-0.94.tar.gz ok
Scanning cache /home/rohan/.cpan2/build for sizes
Uncompressed /home/rohan/.cpan2/sources/authors/id/I/IL/ILYAZ/modules/MP3-Tag-0.94.tar.gz successfully
Using Tar:/bin/tar xvf /home/rohan/.cpan2/sources/authors/id/I/IL/ILYAZ/modules/MP3-Tag-0.94.tar:
Couldn't untar /home/rohan/.cpan2/sources/authors/id/I/IL/ILYAZ/modules/MP3-Tag-0.94.tar
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>200 OK</title>
</head><body>

OK

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


<address>Apache/2.0.52 (Fedora) Server at 127.0.0.1 Port 80</address> </body></html>

As seen, I think the CPAN stuff gets initialized properly. All the necessary files are created in /home/rohan/.cpan. I guess there is some problem during the untar. I just can't seem to get it!

Replies are listed 'Best First'.
Re^3: using CPAN through web
by tlm (Prior) on Mar 29, 2005 at 22:44 UTC

    The only thing I can think of is that /home/rohan/.cpan/build is not writable by apache, but from the description you gave in your original post it doesn't sound like that's the problem.

    the lowliest monk

      It is writable

      # ls -l /home/rohan/.cpan/
      total 5452
      drwxr-xr-x  3 apache apache    4096 Mar 30 04:19 build
      -rw-r--r--  1 apache apache 5560000 Mar 30 03:43 Metadata
      drwxr-xr-x  4 apache apache    4096 Mar 30 03:41 sources
      

      Whats more, the directory too gets created!

      # ls -l /home/rohan/.cpan/build/tmp/MP3-Tag-0.94/
      total 116
      -r--r--r--  1 apache apache  1212 May 29  2004 cddb.tm
      -r--r--r--  1 apache apache  1151 Feb 10  2004 cddb.tmp
      -r--r--r--  1 apache apache 14789 Sep 17  2004 Changes
      
      -r--r--r--  1 apache apache  4277 Mar 12  2004 data_pod.PL
      drwxrwxrwx  3 apache apache  4096 Sep 17  2004 examples
      -r--r--r--  1 apache apache   768 May 29  2004 Makefile.PL
      -r--r--r--  1 apache apache   616 Sep 16  2004 MANIFEST
      -r--r--r--  1 apache apache   290 Sep 17  2004 META.yml
      -r--r--r--  1 apache apache  1495 Jan 22  2004 README.txt
      drwxrwxrwx  2 apache apache  4096 Sep 17  2004 t
      drwxrwxrwx  2 apache apache  4096 Sep 17  2004 Tag
      -r--r--r--  1 apache apache 43470 Sep 17  2004 Tag.pm
      -r--r--r--  1 apache apache   704 Jun  7  2001 test.mp3
      drwxrwxrwx  2 apache apache  4096 Sep 17  2004 tk-tag
      -r--r--r--  1 apache apache  1099 Nov 15  2000 TODO
      

      So it seems the module IS getting untarred, but I don't know whats happening after that. :-(

        The relevant section of CPAN.pm (at least in 5.8.4):

        $system = "$CPAN::Config->{tar} xvf $file"; $CPAN::Frontend->myprint(qq{Using Tar:$system:\n}); if (system($system)==0) { $CPAN::Frontend->myprint(qq{Untarred $file successfully\n} +); } else { $CPAN::Frontend->mydie(qq{Couldn\'t untar $file\n}); }
        That system call is failing for some reason. I'd check to make sure that (a) the same tar command does not fail on the command line (try something like
        /bin/tar xvf /home/ro...es/MP3-Tag-0.94.tar && echo ok || echo failed
        ), and (b) that there is no difference in content between the stuff untarred by your CPAN CGI script and the stuff untarred from the command line (use the directory form of diff). That may give you some clues for why the system call is failing. You could write a simple CGI script that just untars something via a similar system call, and check for its return value, and thereby begin to narrow down the problem (i.e. CPAN.pm vs. tar), but I admit that I'm grasping at straws here.

        the lowliest monk