PAGI 0.002002: Clarifying How Applications Are Loaded
Introduction PAGI 0.002002 is a specification release. It does not change the runtime shape of a PAGI application. A running application is still one asynchronous code reference: async sub app { my ( $scope , $receive , $send ) = @_ ; await $send -> ({ type => ' http.response.start ', status => 200 , headers => [[ ' content-type ', ' text/plain; charset=utf-8 ' ]], }); await $send -> ({ type => '…
PAGI 0.002002 is a specification release that does not alter the runtime structure of a PAGI application. A running application remains a single asynchronous code reference. The clarification focuses on how a general-purpose runner interacts with the runtime boundary. The specification originates from ASGI, which describes an application as an asynchronous callable receiving three values.
In Python, this callable can be a function or an instantiated object with a __call__ method. However, Perl does not usually treat a blessed object as a code reference. To maintain a clear boundary, PAGI 0.002002 now makes it explicit that a general-purpose application runner should accept either a native PAGI code reference or an already-instantiated object providing a to_app method.
With this convention, an application component can retain configuration while under construction. The object is loaded once, and only its code reference is used for connection dispatch. This approach benefits performance, as route compilation, middleware construction, and application setup occur predictably. It also ensures that broken providers fail during loading rather than after the server begins accepting traffic, maintaining a uniform runtime interface between the server, middleware, and application.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.