Hi,

Is there any way to support CGI.pm (e.g. CGI::param) in Mojolicious? We
have legacy support utilities that mostly do stuff like:

if (param("whatever")) {
    doSomething()
}

but also sometimes/rarely:

my $q = CGI->new();
if ($q->param("whatever")) {
    $q->param('someparam', 42);
    doSomethingElse($q->self_url())
}

?

We're trying to move a legacy codebase from ModPerl::Registry to
Mojolicious. To that end, the existing functionality is running fine
already in morbo with Mojolicious::Plugin::MountPSGI and CGI::Emulate::PSGI.

The issue is with utilities that will be shared between the
legacy/CGI.pm-based code and new mojolicious code.

I guess one clean way could be to create an MyParams.pm bridge
<https://en.wikipedia.org/wiki/Bridge_pattern> class that would encapsulate
CGI->new() in "CGI-mode" and $c->param() in "Mojolicious-mode". One less
clean way would be to fiddle with $c->req->url->query->to_string for GETs
and $c->req->body for POSTs to make CGI.pm happy.

I'm just hoping that others have encountered this and that we don't have to
invent the wheel again, but can learn from your experience.

Sincerely,

Peter

-- 
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