[cgiapp] size of scripts and dependencies
Ron Savage
ron at savage.net.au
Sat Sep 19 03:40:09 EDT 2009
Hi
See below.
On Fri, 2009-09-18 at 09:14 -0500, P Kishor wrote:
> Very good points Michael. My response to some of them below --
>
> On Fri, Sep 18, 2009 at 8:47 AM, Michael Peters <mpeters at plusthree.com> wrote:
> > On 09/18/2009 09:33 AM, P Kishor wrote:
> >>
> >> But, now that we are done
> >> comparing our overweight weight to a morbidly obese weight, how about
> >> CGI::App on its own? To my completely uninformed mind, loading 40,000+
> >> lines to create a small web page sounds like a lot... and, that
> >> doesn't even include the web server and the Perl interpreter!
> >
> > But that's not what you tested. You tested Titanium which is not CGI::App.
> > It's an opinionated framework based on CGI::App and it's plugins. If you
> > just want to create something that makes "small web pages" then just load
> > CGI::App and it's dependencies.
>
> Actually, I did not test Titanium (I only invoked it as an example). I
> tested my own application that is cobbled together with the various
> bits and bobs of CGI::App and various plugins.
>
>
> >
> > Also, let's look at those numbers:
> >
> > DBI - 7824
> > CGI::Simple - 3900
> >
> > That's 1/4 of all those lines just right there. And if you're going to use a
> > database you need DBI. And if you're going to make a web app you need a CGI
> > interface module (like CGI.pm or CGI::Simple) so I don't see a way to remove
> > those.
> >
>
> I guess that is what I was trying to get at... one of the things that
> many Perl modules (and CGI::App as well) make a big deal about is how
> simple scripts are once you use those modules... for example, the oft
> quoted example of WebApp.pm and instance script being only a couple of
> lines. Well, in reality, all the plumbing is still there, just under a
> carpet.
But it's /meant/ to be under the hood. That's the point of using
CGI::App. You don't need to look under the hood, but you can if you
wish.
> > Also, you're counting just raw lines which means you're counting comments
> > and whitespace (which penalizes modules which are well commented). I'm not
> > saying your criticism isn't valid, I'm just saying that your data is too
> > flawed to support that criticism :)
>
>
> Yes, my data are too flawed, but the criticism is still valid. But,
> instead of kvetching in the wind, I will actually try an experiment. I
> will remove all the comments from the modules that I am using (call
But you don't have to remove the comments. See for example the program
below.
Even thinking of removing comments implies your other comments are
equally dubious.
> them the "production versions," analogous to the packed/minified
> Javascript packages floating around), and even try to squish them into
> one file. I am curious as to what I end up with.
>
> Nevertheless, thanks for indulging with me in this argument. Your
> points are very valid.
>
#!/usr/bin/perl
#
# Name:
# count.code.pl.
use strict;
use warnings;
use File::Find;
my($count);
# --------------------------------------------------------------
sub found
{
return if (-d $_ || ! -T $_);
open(INX, $_) || die("Can't open($_): $!");
my(@line) = grep{! /^$/ && ! /^[#{}]/} map{s/^\s+//; s/\s+$//; $_;}
<INX>;
close(INX);
$count += $#line + 1;
}
# --------------------------------------------------------------
$count = 0;
my($dir) = shift || "Usage: $0 <dir.name>";
find(\&found, $dir);
print "Line count: $count. \n";
>
> >
> > --
> > Michael Peters
> > Plus Three, LP
> >
> > ##### CGI::Application community mailing list ################
> > ## ##
> > ## To unsubscribe, or change your message delivery options, ##
> > ## visit: http://lists.openlib.org/mailman/listinfo/cgiapp ##
> > ## ##
> > ## Web archive: http://lists.openlib.org/pipermail/cgiapp/ ##
> > ## Wiki: http://cgiapp.erlbaum.net/ ##
> > ## ##
> > ################################################################
> >
> >
>
>
>
> --
> Puneet Kishor http://www.punkish.org
> Carbon Model http://carbonmodel.org
> Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
> Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
> Nelson Institute, UW-Madison http://www.nelson.wisc.edu
> -----------------------------------------------------------------------
> Assertions are politics; backing up assertions with evidence is science
> =======================================================================
> Sent from Madison, WI, United States
>
> ##### CGI::Application community mailing list ################
> ## ##
> ## To unsubscribe, or change your message delivery options, ##
> ## visit: http://lists.openlib.org/mailman/listinfo/cgiapp ##
> ## ##
> ## Web archive: http://lists.openlib.org/pipermail/cgiapp/ ##
> ## Wiki: http://cgiapp.erlbaum.net/ ##
> ## ##
> ################################################################
>
>
--
Ron Savage
ron at savage.net.au
http://savage.net.au/index.html
More information about the cgiapp
mailing list