http://www.perlmonks.org?node_id=614258


in reply to Encapsulating web client side code in Perl modules?

The concept of cooperation between client-side Javascript and server-side Perl where the Javascript is totally encapsulated/hidden within a Perl module strikes me as a promising approach:

Actually this strikes me as the wrong way to do it. Anytime you try to encapsulate one system into another you have 1 of 2 choices:

  1. Limit your usage to only a subset of the wrapped system's functionality
  2. Make your interface to the wrapped system just as complete and complicated as the wrapped system itself.

GWT (Google's Java system to have users avoid writing Javascript for AJAX apps) recently ran into problems with users because they needed to do things that were easy in Javascript but that GWT didn't provide an interface for. Now Java programmers using GWT have the option of passing in strings of Javascript that GWT then injects into the pages. Try debugging that if something goes wrong.

Plus their Java code is now littered with Javascript code. It's the same principle of littering HTML throughout your Perl programs. It was bad in the 90's and it's even worse now.

we can make the web client more productive without having to write an extensive amount of Javascript as some set of functionality can be provided via Perl modules.

Why are you so scared of Javascript? It's not the same beast it was in the 90's and can actually be quite pleasant if you're using the right framework (my favorite poison is Prototype).

Javascript is only going to get more and more important for web technologies. You are really doing yourself a disservice by trying to hide from it.


-- More people are killed every year by pigs than by sharks, which shows you how good we are at evaluating risk. -- Bruce Schneier