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!
|