in reply to Re^2: Call subroutine of main namespace from package in Plack
in thread Call subroutine of main namespace from package in Plack

Perl is an incredibly flexible language that gives the power to execute bad designs. Yours is quite bad, especially in a PSGI pipeline where responsibilities are well designed and compartmentalized; and I encourage you to abandon it immediately.

You should not feel bad, though. It's one of the early "intuitive" things a lot of us, especially self-taught programmers, try to do. The other that is almost a rite of passage is using variables as variable names. Working with raw PSGI is quite ambitious. It's not designed to be for direct webwork but for package authors to use as a platform for their higher level kits which are then in turn used for webwork.

If you break down your project into small bites and present them as questions here, you'll probably get terrific advice and code snippets directly on point. Right now you're mostly getting expert advice on how to do things no one but experts even knows how to do because, like wheelies in traffic, it RFC:SHOULDN'T be done. :P

Update: fixed a grammar booger that was bothering me.

  • Comment on Re^3: Call subroutine of main namespace from package in Plack

Replies are listed 'Best First'.
Re^4: Call subroutine of main namespace from package in Plack
by stevieb (Canon) on Apr 11, 2018 at 21:56 UTC

    This is kind of the response I wish I had time for today, but like all of us, sometimes firefighting in other areas in life take precedence.

    This answer, along with other answers, particularly AnomalousMonks post here spell it out for me.

    I'm still fire-fighting, so if nobody else gets a chance before I can, OP should be introduced into coderefs, and sending in subroutines as a parameter. Somehow I feel passing in function references to a call to a module's functions/methods fit in this case.