-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PSGI file evaluation convention #12
Comments
I load my PSGI apps with "require" instead of "eval do". "require" returns the result of last expression of the file, so that works well. This allow me to make a clean package for the application, with a known namespace, and so I can distribute the application as a CPAN distribution. Also, "require" use @inc to find the file. Here is an example: https://metacpan.org/source/DOLMEN/Pod-POM-Web-PSGI-0.002/lib/Pod/POM/Web/PSGI.pm (have a look at the code AND the POD). |
Yes, I like it, but one problem with require is that you can't instantiate the same application twice, which means it gets moot when the module is preloaded somehow, or when you want to instantiate the app per children in a forked environment.
|
This convention doesn't prevent you from loading your app with require though - this is more lower level discussion that happens in the web server when given a path to the .psgi file. You can always do require MyApp inside .psgi, like you can currently do. Whether your app/framework gives the PSGI code refs with require (as in the return value of the .pm) or |
https://github.com/plack/psgi-specs/wiki/PSGI-file-evaluation-convention
Attach your feedbacks to this issue.
The text was updated successfully, but these errors were encountered: