plack / Plack

PSGI toolkit and server adapters
http://plackperl.org/
Other
486 stars 214 forks source link

Plack::Util::load_psgi: guard against hitting the identifier length limit #663

Open Hugmeir opened 3 years ago

Hugmeir commented 3 years ago

When Plack is asked to load a path with a psgi app inside, ala /foo/bar/app.psgi, it first generates a namespace for the file -- something like Plack::Sandbox::_2ffoo_2fbar_2fapp_2epsgi.

Those "sandboxed" namespaces can get very long. Long enough that they hit Perl's identifier limit of ~250 characters (see https://perldoc.perl.org/perldiag#Identifier-too-long).

This commit patches Plack::Util::load_psgi() that always generates paths shorter than the threshold, and jumps through some hoops to ensure that no two applications end up sharing namespaces after the trimming.