https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42663 --- Comment #13 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #12)
(In reply to David Cook from comment #8)
(In reply to David Cook from comment #7)
But the problem is Koha isn't an MVC web app like Catalyst, and Catlayst also only applies to web apps. It doesn't cover things like CLI tools or cronjobs. (That's why you end up with modules like https://metacpan.org/pod/Config::JFDI which provide Catlayst config outside of a web context.)
I mean I say it's a problem... I suppose we'd have those other components that can be used in the CLI tools and cronjobs so that's good... that should take care of those situations.
Maybe the only problem is that Koha::Context->current().
Koha::Context shouldn't depend on Koha::Middleware::Context. In fact, I don't think that we really need Koha::Middleware::Context. All Koha::Context->current() needs to do is return a singleton. So check for the $ENV{"koha.context"}. If it's set, return its contents. If it's not set, set it. That's it.
We cannot store structures in ENV, only strings. That's why I need to reuse the psgi_env var from the middleware.
That's a good point about ENV. That's what caused that Business::ISBN issue recently... But now that I think about it - why use an environmental variable at all? It can just exist within a variable in Koha::Context. You can just my $instance at the file level in Koha::Context and it's all good. -- You are receiving this mail because: You are watching all bug changes.