Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^8: Plack Middleware aXML

by chromatic (Archbishop)
on Oct 20, 2011 at 21:24 UTC ( #932759=note: print w/replies, xml ) Need Help??

in reply to Re^7: Plack Middleware aXML
in thread Plack Middleware aXML

It would be interesting to see just how many lines of Perl you need to trigger the same functionality as this example.

That's not a fair comparison, for several reasons:

  • SLOC isn't an interesting metric until you get to orders of magnitude difference
  • Comparing a framework to something at a different abstraction level is misleading
  • There's running Perl code behind the aXML example that looks much like the eventual Perl code someone would have to write anyway
  • SLOC isn't the only meaningful concern. Consider syntax checking or highlighting, or debugging, or testing. The Perl infrastructure and toolchain has quite a few advantages over aXML due to its maturity

I'm not saying aXML lacks its advantages, but concision alone isn't such a meaningful metric.

Also your example Perl 5 code has a security hole. (We've talked about this before.)

Improve your skills with Modern Perl: the free book.

Replies are listed 'Best First'.
Re^9: Plack Middleware aXML
by Logicus on Oct 20, 2011 at 22:22 UTC

    not a fair comparison..

    It's difficult to find a fair comparison when we are talking about such different paradigms. I'm not trying to replace Perl's syntax, so much as wrap it in a container which makes it easier and quicker to assemble batches of complex imperative statements using a simple declarative syntax.


    Sometimes there is little difference, and sometimes you do get several orders of magnitude advantage. For instance on the old system there was a plugin called aJAXchat (I haven't got round to porting it to the new one yet), which allows for any page of any project to instantly include an ajax powered chatroom by simply adding this :


    The more abstract you get with the tags and their meanings the greater the advantage you gain. Some of the plugins are hundreds of lines of code, and can be accessed, and layered with the other plugins to create even greater complexity. I.E ;


    Now suddenly the chat room only appears if the debug flag is set... why you would want to do that is beyond me, but the principle is sound.

    Your right when you say that someone would have to write the Perl code anyway to give the tags their meanings, but once written that tag then becomes a reusable package which as I mentioned can be used in concert with all the other packages. Write once, use many.

    (loggedin) <aJAXchat>rooms/<qd>roomname</qd></aJAXchat> (/loggedin)

    >>syntax checking or highlighting, debugging, testing.

    When your confident, as I am, that the lower level of the system is bug free (especially the older version), then you find that the only place bugs exist is at the document level, and nearly always its because you've left out the / from the end tag or something silly like that. The very nature of the syntax and the way it reuses batches of pre-written and well tested code lends itself to coding with very few bugs. With that in mind, consider then that a lot of the testing and debugging tools needed for the full blown complexity of Perl are just not needed to check if an aXML document has the correct syntax.

    As for saying Perl has advantage over aXML due to maturity, that's still thinking of aXML as being some sort of rival or equal to perl, it isn't, it's just an abstraction layer which implements a higher order and makes for quick and easy construction of statements which require a lot less brain power to build and debug than the Perl code which powers it.

    security hole... yeh I remembered that when I was typing it but I was just like bleh, its only a silly little incomplete example anyway.

      Also it will be nice at some point when I have the time, to get down to writing an editor for it or extending something like Padre.

      I have some ideas in mind for instance


      The syntax highlighter (and checker) would not need to know anything about what the tags actually do, all it needs to understand is the bracket schema.

      Also, I had in mind the ability to run a tag in isolation so you can see what it returns, and possibly if the editor is smart enough it could add a + sign next to things like the <inc> tag so you can see the result of including the given path. I.E;


      Then when you click on the + sign the sub "inc" gets run, loads the file with the given path, and displays its results inline;

      here is the file you requested

      You could then edit the loaded file in place, and when you click the - the editor saves both files. and returns the display to how it looked at the start. This gives the advantage that you can be sure your path statement is correct, you can create and edit a new file by typing in the path and clicking the plus sign, and you don't need to worry about saving the files or having multiple windows or tabs open with different files to switch between them.

      The sub file can also contain another nested heirarchy of tags, including more statements to include, like russian dolls.

      When your building a new system you open the editor and start by typing :


      Then you give the editor a request so that the value of action is known, click the + and start writing that action, when your done with that action you give the editor another request and start writing the next action and so on.

      I will eventually get round to writing this, but I only have one pair of hands and right now I have significantly more important tasks to complete so I can get out of having to visit the jobcenter twice monthly to beg for my survival pittance.

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
        <html lang="en">
            <link href="/css/main.css" rel="stylesheet" type="text/css">

            <div id="navigation"> (inc)common/welcome(notloggedin)guest(/notloggedin)(/inc)</div>

            <div id="content">(inc)actions/(qd)action(/qd)/main(/inc)</div>


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://932759]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2017-02-24 09:42 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (353 votes). Check out past polls.