Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^8: Perl Contempt in My Workplace

by 1nickt (Canon)
on May 05, 2021 at 18:22 UTC ( [id://11132092]=note: print w/replies, xml ) Need Help??


in reply to Re^7: Perl Contempt in My Workplace
in thread Perl Contempt in My Workplace

what CPAN module should I use for the "server-side processing"?

Why do you need a module? Can you describe what such a module would do?

So you have a web server and you receive an ajax request with all the many parameters needed to fetch the next page of results. If you were using a module and you wanted to provide those parameters and get back JSON, what would the module do? Isn't it only to query the DB and convert the results to JSON? So what should the module do? Wrap up the DB query with some layers of abstraction? By the time you wrote the config needed you could have written the handler directly with DBI.

I admit I often have some custom filtering/ordering code in the ajax route handler that preprocesses the DB query but as I said before I don't see how that could productively be abstracted.


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^9: Perl Contempt in My Workplace
by vkon (Curate) on May 05, 2021 at 18:55 UTC
    why I need a module - because I want to stay on shoulders of giants and not reinvent the wheels.
    my plan was to find some plugin for Catalyst of Mojo or Dancer or whatever so to have my database "just work" - like in https://datatables.net/examples/server_side/simple.html - just a table but also with excel-like filtering
    I agree that productive abstracting could be problematic in this particular case.

      "my plan was to find some plugin for Catalyst of Mojo or Dancer or whatever so"

      Contrary to what you said earlier:

      "ok, so basically you're suggesting me to redo all negotiations to Jquery/datatables from scratch using JSON::PP and do a lot of fun with modern web frameworks.

      This is exactly what I was trying to avoid"

      Write a perl script query your database in a sensible way (see previous comments), return the data in JSON format. You clearly haven't read any of the documentation for the tools you've decided to use, suggesting another boilerplate module from CPAN would likely not do what you want, and be a waste of time. Also yes, you are wrong in your assumption about module numbering, and almost everything else you've written in this thread to date.

        I do not see how my 2 statements contradict to each other. I was searching for some existing solution (catalyst or dancer of whatever)
        and I do not want to reimplement "server side processing" - I want to reuse something that already exists.

        how these 2 statements contradict to each other?

        my SQL statement is simple: SELECT * from MYTABLE

        Do you have perl solution with datatables with excel-like sorting and filtering, given that MYTABLE is large enough so it is not realistic to send entire table to client?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found