<div dir="ltr">Hi PM,<div><br></div><div>In the thread discussing CGI, mod-perl and other frameworks, I thought it might be worth discussing the good/bad points of CGI, and/or other lightweight web-tools.  Am interested in other peoples thoughts.<div><div><br></div><div>Generally speaking whenever I use a framework, in particular web-frameworks, they dramatically simplify about 80% of the workload - at the expense of making the last 20% near-impossible to work around.</div><div><br></div><div>eg:</div><div>- Catalyst about 5 yrs ago, was pretty good for its time at integrating database I/O - unless you had a table with a multi-column primary key.</div><div>- Anything with Java Spring - yay for a few lines of code to handle CRUD; boo for knowing which config/xml file to modify just to set it up first time</div><div>- Java Hibernate v2 and v3 - again multi-column primary keys.</div><div><br></div><div>As such, my gut-feel is that "there be dragons whenever a framework is used".</div><div>On the other hand "Libraries are awesome".<br></div><div><br></div><div><br></div><div>A similar discussion has taken place around bless() vs using Moose, et al.</div><div><br></div><div><br></div><div>So stepping back to learn from what we know... and since CGI.pm started this discussion...</div><div><br></div><div>Good bits :<br></div><div><div>-  param(), url_param(), cookie()</div><div><br></div><div>Bad bits:</div><div>-  param and url_param ... why isn't there a way to get all params...  </div><div>- it would be nice if CGI could work a little nicer with Getopt::Long so that in non-GATEWAY_INTERFACE mode, it would use command-line arguments  [... sounds like a useful module idea ! ]</div><div>- the whole "html shortcuts" thing.</div></div></div><div><br></div><div><br></div><div>Other people's thoughts on CGI.pm?</div></div><div>What other "basic tools" really help you get your work done?<br></div><div><br></div><div>cheers,</div><div>Mathew</div><div><br></div><div><br></div><div><br></div><div><div>eg: I have this that I load up in almost every bit of code that I write, so that it gives me some (more!) globals, and sets $0 to be "$perl_script" (instead of "perl $perl_script").... Obviously doing this everywhere comes with a start-up cost.</div><div><br></div><div>package Lib;</div><div><div>BEGIN {</div><div>  $TIME0 = [gettimeofday];</div><div>  $BASENAME = basename($0);</div><div>  $BASEPATH = abs_path(dirname($0)) || "";</div><div>  $BASEPATH = '/' unless (length $BASEPATH);</div><div>  $FULLNAME = $0 =~ /^\// ? $0 : ($ENV{PWD} ? $ENV{PWD}."/".$0 : $0);</div><div>  $FULLNAME = canonpath($FULLNAME) || "";</div><div>  while ($FULLNAME =~ /\.\./) {</div><div>    $FULLNAME =~ s/\/?[^\/]*?\/\.\.//;</div><div>  }</div><div>  $DIRNAME = "".$FULLNAME;</div><div>  $DIRNAME =~ s/\/$BASENAME$//;</div><div>  $DIRNAME = '/' unless (length $DIRNAME);</div><div>  if (!$ENV{GATEWAY_INTERFACE} && !$ENV{MOD_PERL}) {</div><div>    lib->import($BASEPATH);</div><div>    $0 = "$BASEPATH/$BASENAME".(@ARGV == 0 ? "" : " ".join(" ",@ARGV));</div><div>    eval {</div><div>      require Sys::Prctl;</div><div>      Sys::Prctl::prctl_name($BASENAME);</div><div>    };</div><div>  }</div><div>}</div></div></div><div><br></div></div>