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

Re: Dual-life perl 5-or-7 code and prototypes - impossible?

Thread Previous | Thread Next
Paul "LeoNerd" Evans
June 29, 2020 15:23
Re: Dual-life perl 5-or-7 code and prototypes - impossible?
Message ID:
On Sat, 27 Jun 2020 19:29:42 +0100 (Dagfinn Ilmari Mannsåker) wrote:

> The B::CompilerPhase::Hook module lets you programmatically enqueue
> phasers:
> Sticking the above code in a Sub::Attribute::Prototype::import() and
> replacing UNITCHECK { ... } with enqueue_UNICHECK(sub { ...}) works.

Ahyes :)

So armed with this knowledge I have now created

> Hoewver, another issue is that because the prototype isn't set until
> UNITCHECK time, it will not apply to calls in the same unit as the
> prototyped sub is defined in, so this is really only useful for
> modules that export subs, not scripts.

Ahyes, an annoying caveat. That and the other two are noted in the docs:

Because of these limitations, I'm probably not even going to convert my
own modules (e.g. List::UtilsBy) into using this one yet. I'd welcome
anyone trying to help improve the situation and get rid of these
problems, but currently it seems I shall have to leave List::UtilsBy in
a 7-unsafe state.

Paul "LeoNerd" Evans      |  |

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About