Edit: I have identified the error (Thanks bliako). I was not using the explicit $exception->{exception} value and this was causing the confusion/inconsistencies in the code. Please excuse me for the confusing indentations and format on this post. I tried to edit down the original code to something more readable, but failed miserably at it. Thank you everyone for the advice as well, it is very appreciated.

Couldn't figure out a way to search this problem, so I apologize if it has been answered before. Additionally, I am very new to perl, excuse me if i overlook something obvious.

I am working on creating an email alert for a data load that goes through every day at my company. There are a number of modules that do essentially the same thing a few different ways for the different sets of data. What I was tasked to do is create alerts whenever the data is not loading properly, specifically when the file does not exist. This was pretty simple to start, but I've hit a roadblock for a few of the modules.

Currently I have a subroutine that reads:

if (-e $filepath) { # the file exists if (-M $filepath > $maxage_days) { my $exception = { table => $tablename, exception => 'outofdate', data => { file => $filepath, age => sprintf("%.2f", (-M $filepath)*24) . ' hou +rs', still_copying => 0 } return ($exception); }; else { my $exception = { table => $tablename, exception => 'nonexistent', data => { file => $filepath, age => 0, nonexistent => 1 } }; return ($exception); }

The $exceptions are returned to one of the main modules (whichever is currently being used) and proceeds to run down its every day instructions.

I have implemented another if statement to check if the returned $exception is "nonexistent":

if ($exception eq 'outofdate' or $exception eq 'stillcopying') { $biuw->{log}->warn("$FEED_PATH . $FEED_FILE_BASE_NAME is out o +f date. Loading stopped.\n"); return $exception } if ($exception eq 'nonexistent') { $biuw->{log}->warn("$FEED_PATH . $FEED_FILE_BASE_NAME does not + exist. Loading stopped.\n"); return $exception; }
The majority of the results are exactly what I need. The script fails, a log stating that the $filepath does not exist, and an email is sent out to our alerts queue (this is done in the main module that organizes all the others.) What I am getting with two of them, is instead of proceeding the normal way, I get these logs:
sh: /home/ftp01.mbira.com/reports/futu.data: No such file or directory md5sum: /home/ftp01.mbira.com/reports/futu.data: No such file or direc +tory

The script continues to attempt to load the data, but hits a number of issues as the file path does not exist. I am not sure why two of the modules are creating these logs instead what is instructed, but the other modules will simple generate the error and email and then end.

Any thoughts on where to look for trouble shooting this error, or maybe some kind of explanation of why the -e command is generating these md5sum and sh logs?


In reply to Origin of 'md5sum' and 'sh' logs by drw

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.