If it's just to get the parameter values,

$app->add_helper('param' => sub { return shift->req->param(shift) })

might do the trick, as long as you pass the controller object to
whatever expects to be able to use ->param. For a full CGI-compatible
mockup, I guess you can just create a plugin that creates all the
required helpers to make that work.

If I have some free time I might just do that...



On 08/03/2016 02:33 PM, Lee J wrote:
> On Tuesday, August 2, 2016 at 4:58:05 PM UTC+2, Joel Berger wrote:
>
>     Have you tried
>     using https://metacpan.org/pod/Mojolicious::Plugin::CGI
>     <https://metacpan.org/pod/Mojolicious::Plugin::CGI> I know that
>     Lee Johnson has used it to help port other CGI applications and
>     has put it to video at least once (yes the title card seems to be
>     wrong): https://www.youtube.com/watch?v=dywft_QfGLI
>     <https://www.youtube.com/watch?v=dywft_QfGLI>
>
>
> I think the problem here is the half and half approach. M::P::CGI will
> just exec your cgi scripts and return the output once finished,
> whereas the OG poster here wants to emulate CGI->param *within* the
> mojo app process due to the tight coupling of their library code to
> CGI.pm. I think fundamentally you will have problems with any code
> running CGI.pm under Mojolicious (i.e. not exec'd like the plugin) as
> CGI will do all sorts of evil things with STDIN and such. That said, i
> know there have been changes to the plugin recently as the author of
> some ancient wiki software was porting to Mojo and running into the
> same problems (i forget which software, you'll find various PRs and
> Issues in the M::P::CGI repo on github).
>
> The least evil thing (hoho) you can do here is probably create a
> compatibility package as stated. If they're still shared between
> legacy and new code then you're going to have fun, and you probably
> just want to throw that stuff away anyway.
>
> Lee.
> -- 
> You received this message because you are subscribed to the Google
> Groups "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to