develooper Front page | perl.perl5.porters | Postings from June 2022

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
From:
Dan Book
Date:
June 7, 2022 15:55
Subject:
Re: Pre-RFC: yield true feature
Message ID:
CABMkAVX8nog8XS6hqfCt6wa_Ud-2e7HrFt0XNfVOwD=FuwCBbA@mail.gmail.com
On Tue, Jun 7, 2022 at 11:53 AM Eric Brine <ikegami@adaelis.com> wrote:

> On Tue, Jun 7, 2022 at 1:59 AM Tony Cook <tony@develop-help.com> wrote:
>
>> There would be no change for "do", it doesn't require truthiness.
>>
>
> C<do> actually does require the return of a true value if you want to
> detect failures.
>
> do(...) or die $!;   # File not found, etc
> die $@ if $@;        # Syntax error, runtime exception, etc
>
>
That's only due to the deficiencies of the do() API and the convention you
wrote - not an intrinsic part of the API. do can still be used on a file
that returns false if you don't perform that particular check.

-Dan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About