Hmmm... okay I have no checked all the retrun values as you quite rightly suggested and it appears that $tar->error contains...

"No such file or directory"

That is not good.. so I checked and double checked that the file is there, it is. So I thought to make sure I would do an exsits file test (-e) The test found the file.

So why would Archive::Tar report that the file wasn't there when an exsits test says the file is there?

Here's the revised code

sub extractTarFile{ print $cgi->header(); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime( +time); $year = $year + 1900; $mon = &formatDigit($mon ++); $mday = &formatDigit($mday); $hour = &formatDigit($hour); $min = &formatDigit($min); $sec = &formatDigit($sec); $submissionID = "$year-$mon-$mday-$hour-$min-$sec-$user_Name"; # +yyyy-mm-dd-hhmmss mkdir "$submittedFiles/$submissionID", 0777 or warn "Cannot make d +irectory: $!"; copy ("$tmpFilePosition", "$submittedFiles/$submissionID/$user_Fil +e_Filename"); $tarLocation = "$submittedFiles/$submissionID/$user_File_Filename" +; $RC_open = open TARFILE, $tarLocation; if (-e TARFILE){ print $cgi->p("File exsists"); } $RC_new = $tar = Archive::Tar->new(); $RC_extract = $tar->extract_archive("TARFILE"); $tar_errors = $tar->error(); print $cgi->p("Return Val open ($RC_open)"); print $cgi->p("Return Val New tar ($RC_new)"); print $cgi->p("Return Val Extract ($RC_extract)"); print $cgi->p("Tar Location is ($tarLocation)"); print $cgi->p("Tar errors ($tar_errors)"); print $cgi->p("submittedFiles ($submittedFiles)"); print $cgi->p("submissionID ($submissionID)"); print $cgi->p("userFileFilename ($user_File_Filename)"); close TARFILE; }

And the new output from the browser...


File exsists

Return Val open (1)

Return Val New tar (Archive::Tar=HASH(0x3be9cc))

Return Val Extract ()

Tar Location is (/webroot/service/servicelist_submission/submitted_files/2002-09-08-08-32-25-Mark/sample.tar)

Tar errors (No such file or directory)

submittedFiles (/webroot/service/servicelist_submission/submitted_files)

submissionID (2002-09-08-08-32-25-Mark)

userFileFilename (sample.tar)

Whilst I'm at it I'll show you the permissions on the files as well although I don't think it's that...?...

mf139823@esweb: pwd
/apps/webroot/service/servicelist_submission/submitted_files/2002-09-08-08-32-25-Mark
308 mf139823@esweb: ls -l
total 932
drwxr-xr-x   2 nobody   nobody       512 Oct  8 08:32 ./
drwxrwxrwx  23 mf139823 staff       1024 Oct  8 08:32 ../
-rw-r--r--   1 nobody   nobody    461824 Oct  8 08:32 sample.tar
mf139823@esweb

Am I doing something crazy?

Please help!

M


In reply to Re: Re: Extracting files Using Archive::Tar? by heezy
in thread Extracting files Using Archive::Tar? by heezy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.