Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^11: Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?

by Your Mother (Archbishop)
on Nov 06, 2013 at 20:53 UTC ( [id://1061479]=note: print w/replies, xml ) Need Help??


in reply to Re^10: Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?
in thread Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?

I see what you are saying and I'm all for wrapping existing CGIs in adaptors, when possible, but I disagree on principle. This is like insisting that mixing hash access with Moousueusue-based code isn't a problem. Yes, it works, yes it's probably future proof in many cases and somewhat transparent. No, it's still not correct and mixing the two approaches increases the cognitive load/overhead and potential bugs. You insist your future devs be adept at a dead-end and the idiosyncrasies that made it such instead of embracing ideas that span several high-level languages and foster tremendous re-use and cross-pollination. Probably the single best app engine for PSGI stuff is Python/C: uWSGI. It supports PSGI because it was easy.

I feel pretty credible here. I still write CGI.pm based code, I even think, to the appalled reactions of many monks, that it's a perfectly cromulent library for HTML formatting. I'm not the modern for modern's sake monk. I'm the modern for the love of pity why am I still working 90% of the time on code this 1995-awful monk. I would never foist any of this on someone at $work and the times when I end up revisiting this kind of stuff in my own projects I only have regret that I didn't see it might grow/outlast the shoddy/quick path I gambled.

You also gloss the fact that once one knows enough to be able to wrap CGIs to PSGI, which isn't always easy or possible, one knows better than to write the stuff that needs to be wrapped in the first place.

  • Comment on Re^11: Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?
  • Download Code

Replies are listed 'Best First'.
Re^12: Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?
by Anonymous Monk on Nov 06, 2013 at 21:21 UTC

    No, it's still not correct and mixing the two approaches increases the cognitive load/overhead and potential bugs. You insist your future devs be adept at a dead-end and the idiosyncrasies that made it such instead of embracing ideas that span several high-level languages ... You also gloss the fact that once one knows enough to be able to wrap CGIs to PSGI, which isn't always easy or possible, one knows better than to write the stuff that needs to be wrapped in the first place.

    Now that is even more ridiculous than your previous statement

    You can write crap for every backend. The difference between CGI and PSGI is trivial , there is no cognitive load
    sub psgier { my( $env ) = @_; my $req = Plack::Request->new( $env ); my $query = $req->param('query'); my $res = app_logic( $query ); return $res; }
    sub cgier { my $q = CGI->new; my $query = $q->param('query'); my $response = app_logic( $query ); print $q->header; print $response; }

    If you used any kind of abstraction like CGI::Application... then there is no difference of any kind between running on PSGI or CGI

    PSGI is great, bashing CGI is weak

      Sorry for the misunderstanding, I will reword. I didn’t bash CGI and if you knew me you’d realize I’m an apologist for it and have answered many, many questions here with code using it.

      My point is: it’s basically perl4, mixes concerns too much (controller and view and even model and webserver, as implied in this thread’s proxying answers), and has nearly nothing but godawful usage examples in the wild. There is a real drag on learning and grandfathered-gotcha-time that could be spent learning and improving newer stuff. zentara’s Vars bug in this thread is on point. I’m advocating choosing modern tools because they are easier, facilitate learning and sharing across other languages like Python, and are tremendously more friendly to plug-n-play extensibility.

      A good work environment is going to practice some parsimony with its tools and frameworks. Using Dancer AND Mojolicious AND CGI::Application AND Amon AND Catalyst AND raw Plack AND CGI is not the way to run a shop with multiple devs. CGI being the oldest and least well abstracted should be right out.

      I already said I use and will continue to use CGI for personal stuff, testing, terse code answers here, and guaranteed one-offs; it’s still in my default code template. Far from bashing it, I love it. I’m giving what I feel is good advice and the kind of thing that would make the average Perl web development career better; including mine.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1061479]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found