So.. I see this every here and there scattered throughout some subs in my code..

sub resolve_value { my $start_with = another_value() or warn("Could not get another value") and return; # continue.. }

I want to have a function/subroutine that will cause the caller to return something (null in this case), and whatever arguments(s) it may have, are output to STDERR, as warn would.

So the same thing rewritten would be as..

sub resolve_value { my $start_with = another_value() or wreturn("Could not get another value"); # continue.. }
(Setting aside how useless and waste of time these kind of "ideas" are..)
Where would I start to look for reading about- how to do this? (This is not necessarily messing with perl internals, is it? That's a little intimidating.)

It's a little bit weird because such a sub/command/keyword/function would not simply return something or not, but would cause the calling code/sub to return, itself.


In reply to how to write a modified return() call? by leocharre

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.