Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found