No, I won't be using Contextual::Return. Anything that feels the need to globally override something as basic as caller isn't something that other modules should depend on (and it appears to have relatively little reason to override it, but I haven't looked at it). Going from my "Chance of success 100%" to a subset of Contextual::Return's "Change of success 63%" is certainly not worth the proposed convenience (not to mention the subtle complexity).

It might be worth having a function that takes a code ref (and a separate one that takes a string). Given the serious problems with such minor magic that made Error something to avoid (Re: Re2: Learning how to use the Error module by example), I didn't want to repeat that mistake.

But it may be that EvalBlock { ... } would only change the semantics exactly as much as eval { ... } would anyway. I'll have to contemplate that a bit (I was thinking that there was some trap with regard to making closures, but a memory leak in old Perls is not enough to prevent me from offering such a simpler interface). I had intended to research that issue but failed to, so thanks for reminding me.

Part of the reason that I didn't go down that road is that I wanted to allow the user to choose how to make their eval "expect one". But I guess I could take a string or block but still leave the appending up to the user (where it will be visible to the next person to read the code). I also didn't want to have to have 4 routines. But I've since decided to pretty much deprecate ExpectNonEmpty(), so just having EvalString and EvalBlock might be the way to go.

I'll at least leave the current interface available for those who want to avoid memory leaks in certain Perl versions.

Thanks again.

- tye        


In reply to Re^2: Devel::EvalError lives (sugar) by tye
in thread Devel::EvalError lives by tye

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.