-
Notifications
You must be signed in to change notification settings - Fork 273
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
Deserialization of body broken based on module load order #1339
Comments
Looks like
above sets the app's "serializer_engine" attribute while
doesn't, which can be shown by running
afterwards. |
When you do Building (or running) apps in this way is not considered best practice. Using PR's are more than welcome if you wish to tackle the reported behaviour. Look at how |
The problem, as far as I can tell, is that you're using We have written about it here: http://advent.perldancer.org/2014/9 This is not likely to change. I whole-heartedly recommend moving away from |
Hmm, how do you then combine code that's been spread out over several packages? The docs say to use the "appname" import option, but this seems backwards, as I might want to combine different packages to form different apps. Here's an example: Package "MyAuth" contains authentication logic, including a "hook" to determine who the user is and to create a session, which kicks in before any defined route. Package "MyTest" then makes use of "MyAuth"'s feature and defines some routes, so according to the docs, "MyAuth" needs to say
so that the main script can use
which then pulls in all hooks and routes from both MyTest and MyAuth. But, what do I need to do to use "MyAuth" with "MyOtherTest"? "MyAuth" already has "MyTest" hardcoded. Why can't I simply say Dancer2->psgi_app( ["MyAuth", "MyTest"] ) which seems to be both marked deprecated and doesn't work, as the hook in "MyAuth" won't kick in before a route in MyTest triggers? Plugins to the rescue maybe? |
Given the following module
Foo
:This works:
Output:
This does not work:
Output:
What's strange is that
set serializer
in theFoo
module does affect the serialization of returned values from routes - so it's not as if it has no effect. It's just broken for deserialization of anything sent via the body.The module load order in the psgi wrapper is the only thing that changes. I've also tested this under Apache rather than plackup and the repro is the same.
Versions:
The text was updated successfully, but these errors were encountered: