Thanks Sudial for your advice. Guys This strange how my code flow is going shown for code and error below which works different when code from sub threeYrExpiration is in sub file_handler directly. My code actually deletes the file then goes to beginning of sub then file cannot be found because it was already deleted. Can't figure out why this is happening. Logic seems to be correct.
sub threeYrExpiration($) { my $abs_filename = $_[0]; $logger->debug("abs_filename: $abs_filename"); # delete expired file my $unlinkStatus = unlink("$abs_filename"); $logger->debug("unlinkStatus: $unlinkStatus"); if ($unlinkStatus == 1) { $unlinkCountTotal++; $abs_filename =~ s#.*WORKAREA\/[^\/]*##; push (@deleted_files, $abs_filename); $task->AddFile("$abs_filename", "Deleted by content expiration + report"); $logger->debug("File to be deleted added to job: $abs_filename +"); #deleted files updateCriterionReports($criteria[1],$abs_filename,$meta_exp_da +te); $logger->debug("unlinkStatus: $unlinkStatus"); } else { $logger->debug("unlinkStatus: $unlinkStatus"); # shows error description, reason for failure $logger->warn("Failed to delete '$abs_filename': <$!>"); # $logger->debug("File to be deleted \"$abs_filename\" failed. +Received $unlinkStatus instead of 1."); $task->CallBack(1, "Error Deleting expired file"); exit(1); } }

Mon Nov 29 14:35:13 2010 : INFO : expiration_report.ipl : File to be deleted added to job: /committees/comm_wkgrps/inactive/cold_snap_tf/europepass.pdf

Mon Nov 29 14:35:13 2010 : DEBUG : expiration_report.ipl : abs_filename: /iwmnt/default/main/internet/WORKAREA/home/committees/comm_wkgrps/inactive/cold_snap_tf/europepass.pdf

Mon Nov 29 14:35:13 2010 : DEBUG : expiration_report.ipl : unlinkStatus: 0

Mon Nov 29 14:35:13 2010 : DEBUG : expiration_report.ipl : unlinkStatus: 0

Mon Nov 29 14:35:13 2010 : WARN : expiration_report.ipl : Failed to delete '/iwmnt/default/main/internet/WORKAREA/home/committees/comm_wkgrps/inactive/cold_snap_tf/europepass.pdf': <No such file or directory>


In reply to Re^2: Delete file from sub call within another sub by begood321
in thread Delete file from sub call within another sub by begood321

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.