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

Re: Perl Contempt in My Workplace

by vkon (Curate)
on May 05, 2021 at 11:16 UTC ( [id://11132058]=note: print w/replies, xml ) Need Help??


in reply to Perl Contempt in My Workplace

I agree with you and share your feelings.

I like Perl syntax. Coding/using in perl is enjoyable experience, whereas on other languages there are many places which are not as good as in Perl.

~10 years ago Perl ecosystem was huge - you could find almost everything on CPAN - it was clear for me that Perl solution is always the best (well, almost :) )

However - now I pretty much understand and even support a point of perl refusals.
There are too much missing things in Perl right now:

  • CPAN no longer covers all modern techniques:
    • WebASM - there was some discussion on p5p about a year ago but this went nowhere.
    • "neural network" and other data science - there are some old modules but ecosystem is almost empty, at least compared to other languages
    • etc.etc.etc...
  • Core language:
    • simple file reads which are present in Python/NodeJS but "cumbersome" in Perl.
      I want functionality of IO::All but available everywhere even without CPAN access. IO::All is too heavy
    • Sets and simple things like 'x' in ('a' .. 'z'); I can write exists {map{$_=>1}'a' .. 'z'}->{x} but this is too much. Core language does not have this as simple as I want it

starting from about ~10 years ago things have globally changed.

Now some personal recent experience.

Recently I tried to use JQuery/Datatables and even found several CPAN modules for it, tried to use these and failed.
After I've failed in perl, I succeeded with NodeJS on that, I got what I needed. I had confirmation on my table that other language's ecosystem is more current.

Perl is no longer of that 20 years ago.
Sorry, guys.

I am still missing 'use strict' in Python, and 'use strict' of NodeJS is not as complete as Perl's one. And also missing brevity of regexps,

....but also I understood that brevity of regexps is compensated by additional code which is needed for instant file reads and other missing core features.

Replies are listed 'Best First'.
Re^2: Perl Contempt in My Workplace
by marto (Cardinal) on May 05, 2021 at 11:28 UTC

    "Recently I tried to use JQuery/Datatables and even found several CPAN modules for it, tried to use these and failed. After I've failed in perl, I succeeded with NodeJS on that, I got what I needed. I had confirmation on my table that other language's ecosystem is more current."

    All you have to do is send a JSON response for Datatables to read, you don't need 'Datatables' module to do that. JSON::PP is core. For what it's worth putting together a Datatables heavy application took almost no effort using Mojolicious::Lite for handling everything.

    Update: Added JSON::PP is core.

      ...but this means I need to do all my heavy-lifting myself, whereas I want be standing on shoulders of giants.

      ok, you probably know this http://datatables.net/ better and probably already solved similar tasks
      probably it's my fault for not finding a good way in Perl - but for me - 20+-year perler - it wasn't easy to do in Perl but easy to do in NodeJS - that infrastructure is currently better supported

        I'd never used Datatables before, the first page you linked to highlights what can be used as a data source, it's not a perl specific thing. Expecting programmers to write code isn't unreasonable. Adding needless dependencies is a dangerous thing, as NodeJS developers found out to their peril.

        Update: "...but this means I need to do all my heavy-lifting myself, whereas I want be standing on shoulders of giants. " that's why JSON::PP is core, you just return the data (from database query or other munging) in JSON format. A more polished end to end process is why this is also part of modern web frameworks like Mojolicious, and why they're such fun to work with, e.g. $c->render( json => { data => $griddata, cols => \@cols } );

        For data heavy applications (especially using databases), you will always have to do a lot of heavy lifting yourself.

        As soon as your data goes above a certain threshold for size and/or complexity, a "standard" data handling module (in any programming language) will probably not cut the mustard. Sooner or later you'll end up writing your own SQL statements, throw in some caching and adapt the whole thing to your exact requirements anyway.

        For DataTables this is especially true. First of all, the JS part has tons of options and tons of plugins. So, a completely generic backend would have to replicate everything, potentially making it a big mess of spagetti code that moves at the speed of a glacier.

        And secondly, if you use paging or scrolling in DataTables, especially in combination with filters and JOINs over multiple tables, this will just not work with some SQL statement thrown together by a generic module. It'll bog down the server and bore the user to death. Scrolling in particular can generate multiple requests per second, so you'd better optimize the heck out of your backend.

        Edit: I do have some more or less generic modules for DataTable based listing of any old PostgreSQL table, but it's tightly integrated in my PageCamel framework, so it probably wont be any use to you. But just in case you're interested to see how i did it, it's in the ListAndEdit webserver module.

        perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'
Re^2: Perl Contempt in My Workplace
by choroba (Cardinal) on May 05, 2021 at 13:38 UTC
    > Recently I tried to use JQuery/Datatables and even found several CPAN modules for it, tried to use these and failed. After I've failed in perl, I succeeded with NodeJS on that, I got what I needed. I had confirmation on my table that other language's ecosystem is more current.

    Whose magic wand's going to fix that? If you find a library is missing, you are the best candidate to fill the gap!

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      So I found that the library was missing (not exactly missing - there were CPAN modules which haven't fulfilled my needs)
      but I found what I needed in nodejs ecosystem http://www.npmjs.com/

      But I see your point about creating such a module myself and uploading it to CPAN. And ~10 years ago it was the approach which I probably have choose, because all other libraries are here on CPAN.

      Perl have lost critical mass of its users, who will fill the gaps on missing modules, unfortunately for me and for other perl users.

        "who will fill the gaps on missing modules"

        Various 'Datatables' modules exist on cpan, you didn't say which ones you tried and how they failed. Luckily, you don't need a perl module to return the data required for datatables, as has been made clear to you, the perl core modules achieve this without issue.

Re^2: Perl Contempt in My Workplace
by bliako (Monsignor) on May 07, 2021 at 20:02 UTC
      I saw this blog of 2017,
      Reading such articles exactly give an impression that now CPAN have many missing areas of modern techniques
      Fortunately Sergey published CPAN module for the missing piece that he found.

      My sincere gratitude goes to him, and also to you, who provide efforts to improve this situation.

Re^2: Perl Contempt in My Workplace
by 1nickt (Canon) on May 05, 2021 at 14:40 UTC

    I've been using DataTables for years and have never found a use-case where a module would have helped. You prepare your data and send it to the front end as JSON. All the heavy lifting in that application is in writing the JS and particularly the CSS. You make a good point but this is a bad example.


    The way forward always starts with a minimal test.
      ...ok,
      so probably I should have posted my question here and you could have helped me back then. That's good. :)
      Perlmonks is a very strong point of Perl community.

      Still, I do not think of my example as "bad example".

      see: I tried different CPAN modules, but these haven't fulfilled me.
      I honestly searched both Perl @ cpan+perlmonks+google and searched nodejs @ npmjs+stackoverflow+google and found better solution in nodejs land.

      I am a bad searcher? probably. should I improve my google-fu? probably.
      However I still think this is not a bad example in a sense that this is a real-life example.

      I am some poor user who found some solution outside of perl for some reasons....
      I do not think that I am alone with such experience

        I don't think you are a bad searcher ... I just think Perl devs maybe get their hands dirtier than JS devs? For reference, see my repo at https://github.com/1nickt/ContactMyReps. I am genuinely interested in where you think that a module would have helped in that case. Which part of my Perl code is replaced by your node solution?

        Thanks!


        The way forward always starts with a minimal test.
Re^2: Perl Contempt in My Workplace
by Anonymous Monk on May 07, 2021 at 18:16 UTC

    I think that the proper thing to have done would have been to write a new CPAN module that's "exactly what you needed," then share it. Nevertheless, it's impossible for every language to be everything to everybody. That's why we invented – and, very regularly use – more than one programming tool. Why try to "re-create gprolog in perl when you've already got gprolog? Why dumpster-dive into "WebASM" if your only motivation for doing so is to say that you have done it? There's utterly no point.

    rust recently appeared as a brand-new language because a group of engineers realized that they were facing a brand-new use case that other languages didn't yet cover. So it goes. Perl is a venerable tool in a society of tool-builders.

      we invented

      lol. "we"

      recently appeared as a brand-new language ... brand-new use case

      Clueless, as usual, mike.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found