Re: Any gotchas with CGI and Mouse running together? ( Moo not Mouse )
by Anonymous Monk on Feb 25, 2015 at 03:57 UTC
|
| [reply] |
|
|
| [reply] |
|
|
| [reply] |
Re: Any gotchas with CGI and Mouse running together?
by Your Mother (Archbishop) on Feb 27, 2015 at 01:39 UTC
|
No real gotchas. I prefer Moo to Mouse/Moose. I think the defaults are better and things like inline “type” checking more Perlish; more self-documenting; easier to remember.
Mouse is much faster than the other meta-OO options. So, if this were my project the choice between Moo and Mouse would boil down to the execution. If the app is persistently executed, I’d pick Moo, otherwise, Mouse. If it’s persistent then you should be looking at running/harnessing it as PSGI too, whether or not the base code is in CGI.
…Then again, some casual tests on the command line suggest the start-up speed of Moo is only 0.001s slower than Mouse so maybe Moo anyway depending on how many objects and how much access you’re wrangling. I have also had far fewer cross compat/build/deps problems with Moo than Mouse or Moose, FWIW; in a very static env this shouldn’t matter though.
| [reply] |
|
|
| [reply] |
|
|
| [reply] |
|
|
I don’t think it’s silly. The Mouse is precompiled essentially being XS (when built with it). I expected it to be faster actually but regular old Perl often surprises me with how fast it is. I tend to forget that most of why stuff at work is slow is awful DB code and not just the awful Perl we have. :P Doing thousands of objects and methods would probably make the Mouse a clear winner. So it would depend on how big/complex the code chains will end up.
Start up time is only a (serious) issue if running plain CGI as executables; which is a terrible way to do things but still the easiest. Our codebase at work is 50% legacy CGI that was finally taking 3 seconds to return simple pages—code bloat and universal loading of all the libs we have. Making it persistent (pre-compiled by a master server) fixed (most of the outward perception of) that.
| [reply] |
|
|
|
|
|
Re: Any gotchas with CGI and Mouse running together?
by RonW (Parson) on Feb 27, 2015 at 01:00 UTC
|
For anyone possibly suggesting other combinations, the CGI component is fixed (that's out of my control).
Are you modifying existing code?
CGI is not the only module (family) that "speaks" CGI to the webserver.
| [reply] |
|
|
| [reply] |
Re: Any gotchas with CGI and Mouse running together?
by kcott (Archbishop) on Mar 03, 2015 at 06:29 UTC
|
Many thanks to all for much useful information.
++s have been strewn liberally.
I'm going ahead with Moo instead of Mouse.
| [reply] [d/l] [select] |
Re: Any gotchas with CGI and Mouse running together?
by Arunbear (Prior) on Feb 25, 2015 at 11:23 UTC
|
When you created hand-craft classes did you create get/set methods for all of the object attributes? This is one of the cons of Moo(se), you are forced to trade encapsulation for convenience.
| [reply] |
|
|
| [reply] |
|
|
| [reply] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Any gotchas with CGI and Mouse running together?
by Anonymous Monk on Feb 25, 2015 at 17:23 UTC
|
I would consider Dancer instead. | [reply] |