Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • How can it be easier to put your Perl code in Mason components instead of Perl modules?

    I asked myself the exact same thing reading through the Mason book, but this stuff is used plenty by people way more experienced than I am -- there have to be good reasons, even if I don't understand them quite yet. I don't quite have a complete answer in my mind yet concerning the modules question, but the start of it is something like this: If you've got lots and lots and lots of Perl modules, it might be really ha

    --

    ------------------------------
    You are what you think.
    • I've used HTML::Mason a lot. In fact I'm still mainting quite complex web site powered by HTML::Mason which I started working on about two years ago. My experience is that putting Perl code for anithing other than HTML generation in Mason components is reciept for disaster. Maintaing Perl modules is much easier than Perl code in Mason components.

      I think HTML::Mason crowd fails a prey of coolness factor. I cannot explain it why but when I discovered HTML::Mason for first time (it must be around 0.6x version) I though something like that it must be extremely cool to be able to put Perl code in web pages. When you start hack HTML::Mason apps it fills fun because it fills like a very different way. Unfortunally neither I find it to be fun nor I find it be faster to develop than "traditional" way anymore. It fills that Mason is more flexiable system than "ordinary" Perl but it is not. On evidence for this fact I discovered myself is that HTML::Mason is not suited very well for projects where you want to use MVC pattern and it is pain in the butt to unit test HTML::Mason based apps.

      --

      Ilya Martynov (http://martynov.org/ [martynov.org])

      • s/fill/feel/g :)
        --

        Ilya Martynov (http://martynov.org/ [martynov.org])

      • So put your code in Perl modules. A Mason app with most of it's code in Perl modules will look more or less like a TT app with most of it's code in Perl modules.

        The difference, of course, is that you can break the MVC model when you want to. If you want to all the time, then you'll probably have a mess. But I think 100% MVC is pretty bogus. You jump through ridiculous hoops just to generate the data structures that you pass to your templates, which then iterate through the data structure. You end up c
        • Sorry If I was not clear enough: I was objecting in putting Perl code in Mason components for purposes other than templating.

          If you strickly put all other Perl code in Perl modules then yes, it is almost same as with TT2 (though personally I think it provides much better syntax but it is another story).

          --

          Ilya Martynov (http://martynov.org/ [martynov.org])