Hi Kenneth,

The code shown are just snippets of what I'm trying to do from actual code which is much larger. I am using strict, warnings and diagnostics which compiles error free, I just didn't include it this snippet. I had a typo in previous post. Actual code for subs should be with prototypes in sub definition below, $ was missing. However even with this corrected my code still fails. I have other code with same methodology within complete code using prototypes which works.

In your 1st reply I have tried &threeYrExpiration in sub call but deletion was omitted during process which means the & in front of sub actually affects the input parameter $abs_filename.

Change in logging level to warn and including $! shows actual error. However, this is strange because it says path is correct for actual file but saying doesn't exist as seen in error below:

sub file_handler { my ($abs_filename) = @_; if ((($current_mth == 1) && ($last_day_current_mth == 31)) { threeYrExpiration($abs_filename); } else { sevenYrExpiration($abs_filename); } } # End of sub file_handler sub threeYrExpiration($) { my $abs_filename = $_[0]; my $unlinkStatus = unlink("$abs_filename"); if ($unlinkStatus == 1) { $unlinkCountTotal++; $abs_filename =~ s#.*WORKAREA\/[^\/]*##; push (@deleted_files, $abs_filename); $task->AddFile("$abs_filename", "Deleted by content expiration + report"); $logger->info("File to be deleted added to job: $abs_filename" +); } else { $logger->warn("Failed to delete '$abs_filename': <$!>" +); $task->CallBack(1, "Error Deleting expired file"); } } sub sevenYrExpiration($) { ... ... }

Error:

Mon Nov 29 11:50:42 2010 : INFO : expiration_report.ipl : File to be deleted added to job: /committees/comm_wkgrps/inactive/cold_snap_tf/20040514_FDWG-EGWI_ISSUE_LIST Rev7.xls:

Mon Nov 29 11:50:42 2010 : WARN : expiration_report.ipl : Failed to delete '/iwmnt/default/main/internet/WORKAREA/home/committees/comm_wkgrps/inactive/cold_snap_tf/20040514_FDWG-EGWI_ISSUE_LIST Rev7.xls': <No such file or directory>


In reply to Re^4: 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.