in reply to Re^3: STDIN typeglob
in thread STDIN typeglob

Though I'm definitely not a Web programmer, from an interface and TDD point of view, I pulled a face the instant I saw the constructor using an environment variable to decide whether to read from STDIN or not.

That's clearly CGI. Or, in other words, this module won't work with anything but CGI scripts. Maybe, but just maybe, the magic implemented by FCGI/CGI::Fast resp. ModPerl::Registry might be sufficient to fake enough CGI environment (i.e. faked environment, faked STDIN) to make it work.

Oh, and if you use some CGI library with that module, it is a question of initialisation order if this module will work or not. CGI prefers to read STDIN by itself, and I think it won't be happy if you steal its input data. If you init CGI first, input data for Bod's module is gone.

So, in any case, passing the JSON data as a parameter is way better.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^5: STDIN typeglob
by Bod (Parson) on Jun 13, 2023 at 20:42 UTC
    Oh, and if you use some CGI library with that module, it is a question of initialisation order if this module will work or not

    Having hit this exact problem whilst creating the module, there is a warning about this in the docs.