Gossamer Forum
Home : General : Perl Programming :

How do I extract the files from a .tar.gz file on my web-site?

Quote Reply
How do I extract the files from a .tar.gz file on my web-site?
I have uploaded a .tar.gz file to my web-site and have tried to extracht the content with Archive::Tar, but without luck. According to my web-host the Archive::Tar modul is installed!

The script I use (or more precisely: the lates i have tried) is as follows:

#!/usr/local/bin/perl

use Archive::Tar;
$tar->extract_archive("billeder.tar.gz");
print "Content-type: text/html\n\n";
print "OK its extracted\n";


I am an ignoramus when it comes to perl moduls so the script might by rather stupid. Please help
Quote Reply
Re: [rompole] How do I extract the files from a .tar.gz file on my web-site? In reply to
Do you have ssh access?....if so use:

tar -zxvf billeder.tar.gz

If not, try first creating a $tar object Wink:

Code:
my $tar = Archive::Tar->new("billeder.tar.gz", 1);

$tar->extract($tar->list_files);

print "Content-type: text/html\n\n";
print "OK its extracted\n";

Last edited by:

Paul: Feb 3, 2003, 3:22 AM
Quote Reply
Re: [Paul] How do I extract the files from a .tar.gz file on my web-site? In reply to
Hi Poul!

I have tried your suggestion but I still get the message that the server is uable to complete my request because of an internal error or misconfigurationFrown.

This is the complete script I have used:

#!/usr/local/bin/perl

use Archive::Tar;
my $tar = Archive::Tar->new("billeder.tar.gz", 1);
$tar->extract($tar->list_files);
print "Content-type: text/html\n\n";
print "OK its extracted\n";

I have checked CHMOD and it's set to 777 for both the directory and the file. Can you figure out what else could be the problem?
Quote Reply
Re: [rompole] How do I extract the files from a .tar.gz file on my web-site? In reply to
Chmodding should be 755 not 777

Last edited by:

Paul: Feb 4, 2003, 2:26 AM
Quote Reply
Re: [Paul] How do I extract the files from a .tar.gz file on my web-site? In reply to
doesn't help so I have just e-mailed the system department at my web-host and asked them to confirm what the customer service department have been telling me earlier in the phone namely that the module is installed. Answer - it's not installed but it will be at the next upgrate!Mad

I am sorry I have misspend your timeBlush.



You ask if I got ssh access. I am not quite sure what you mean... is it shell access?
Quote Reply
Re: [rompole] How do I extract the files from a .tar.gz file on my web-site? In reply to
What does your error log report? Check that if you can, if not, add this code somewhere above use Archive::Tar; and see if that helps;
Code:
use CGI::Carp qw/fatalsToBrowser/;

Regards,
Charlie
Quote Reply
Re: [Chaz] How do I extract the files from a .tar.gz file on my web-site? In reply to
I think he has to wait for his host to install Archive::Tar Smile
Quote Reply
Re: [Paul] How do I extract the files from a .tar.gz file on my web-site? In reply to
I think you're correct, I didn't spot anything wrong with your code. Would a bad path to the archive cause the problem maybe?

~CP
Quote Reply
Re: [Chaz] How do I extract the files from a .tar.gz file on my web-site? In reply to
Here is the quote from a couple of posts up :)

>>
Answer - it's not installed but it will be at the next upgrate!
<<
Quote Reply
Re: [Paul] How do I extract the files from a .tar.gz file on my web-site? In reply to
Ooops, missed that :)