On Tue, Jun 7, 2022 at 2:21 PM Eric Brine <ikegami@adaelis.com> wrote: > On Tue, Jun 7, 2022 at 12:55 PM Dan Book <grinnz@gmail.com> wrote: > >> 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. >> > > There is no alternate check if you want an error message. And it would be > rather silly not to provide a useful error message. So there's really no > other way to use it. So I was pretty gracious when I didn't limit myself to > saying " C<do> actually does require the return of a true value". > Well, you could return a true value by something other means. Like returning a defined value and using C<defined(do())> (as per the docs), or setting some var and checking the var. So one needs to return a true value, but it doesn't have to be the final value of the script.Thread Previous | Thread Next