You're right - $0 is set in Schedule::Cron's run method. And, unfortunately for you, that method is a behemoth method which does not give you a lot of flexibility to change anything about it. For example, if you were to derive your own package from S::C, you'd have to pretty much copy and paste the entire method to your own module, minus the one line that sets $0. And then, if a new version of S::C came out with a fix, you'd have to notice and merge the fix manually. That's kinda annoying.

Instead, what I would suggest you do is take the S::C module, change the line that says $0 = ... to say $self->set_process_title(), add a new method called set_process_title that all it contains is the old $0-setting line, take a diff between what you have and the original, and submit it back to the author of S::C as a patch.

Once you have that, then you can create your own Schedule::Cron::NoProcessTitleChange, which @ISA Schedule::Cron, and overrides set_process_title with an empty function (i.e., it does nothing). Then you'll get what you are looking for.

Assuming, of course, that the author likes the patch... though, since we're not actually changing real behaviour, s/he should be fine with, I hope.


In reply to Re^3: Schedule::Cron process name? by Tanktalus
in thread Schedule::Cron process name? by bowei_99

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.