size of scripts and dependencies

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

size of scripts and dependencies

by P Kishor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pursuant to the recent email about Titanium dependency hell, I was
curious as to how big really was my tiny 20 line Perl index.cgi. So,
with guidance from a couple of monks on PM, I add the following line
to my script...

END { system( 'wc', '-l', values %INC ) }


 and got the following (I have reverse sorted them by number of lines of code)

    7824 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBI.pm
    3900 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Simple.pm
    2449 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application.pm
    1535 /usr/local/lib/perl5/site_perl/5.8.8/Config/Simple.pm
    1473 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session.pm
    1472 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/JSON/XS.pm
    1434 /usr/local/lib/perl5/5.8.8/overload.pm
    1299 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Dispatch.pm
    1264 /usr/local/lib/perl5/5.8.8/darwin-2level/Data/Dumper.pm
     891 /usr/local/lib/perl5/site_perl/5.8.8/Exception/Class.pm
     872 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBD/SQLite.pm
     851 /Users/punkish/Sites/carbonmodel/app/_perl/Authen.pm
     833 /usr/local/lib/perl5/5.8.8/darwin-2level/DynaLoader.pm
     716 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/Params/Validate.pm
     614 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/LogDispatch.pm
     604 /usr/local/lib/perl5/5.8.8/CGI/Carp.pm
     566 /usr/local/lib/perl5/site_perl/5.8.8/Devel/StackTrace.pm
     543 /usr/local/lib/perl5/site_perl/5.8.8/JSON/Any.pm
     525 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/Session.pm
     516 /usr/local/lib/perl5/5.8.8/darwin-2level/File/Spec/Unix.pm
     497 /usr/local/lib/perl5/5.8.8/warnings.pm
     456 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Simple/Util.pm
     446 /usr/local/lib/perl5/site_perl/5.8.8/Crypt/GeneratePassword.pm
     440 /usr/local/lib/perl5/5.8.8/Exporter.pm
     437 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch.pm
     376 /usr/local/lib/perl5/5.8.8/darwin-2level/Digest/MD5.pm
     356 /usr/local/lib/perl5/5.8.8/Time/Local.pm
     356 /usr/local/lib/perl5/5.8.8/darwin-2level/XSLoader.pm
     343 /usr/local/lib/perl5/5.8.8/AutoLoader.pm
     340 /usr/local/lib/perl5/5.8.8/constant.pm
     336 /usr/local/lib/perl5/5.8.8/darwin-2level/File/Spec.pm
     327 /usr/local/lib/perl5/site_perl/5.8.8/Exception/Class/TryCatch.pm
     316 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/DBH.pm
     301 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Output.pm
     283 /usr/local/lib/perl5/5.8.8/darwin-2level/Scalar/Util.pm
     274 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/JSON.pm
     274 /usr/local/lib/perl5/5.8.8/Carp.pm
     263 /usr/local/lib/perl5/5.8.8/Text/ParseWords.pm
     259 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/File.pm
     248 /usr/local/lib/perl5/5.8.8/Exporter/Heavy.pm
     236 /usr/local/lib/perl5/5.8.8/darwin-2level/Fcntl.pm
     235 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/Config/Simple.pm
     233 /usr/local/lib/perl5/5.8.8/darwin-2level/List/Util.pm
     226 /usr/local/lib/perl5/5.8.8/base.pm
     214 /usr/local/lib/perl5/5.8.8/Class/ISA.pm
     206 /usr/local/lib/perl5/5.8.8/darwin-2level/lib.pm
     204 /usr/local/lib/perl5/site_perl/5.8.8/common/sense.pm
     194 /usr/local/lib/perl5/site_perl/5.8.8/UNIVERSAL/require.pm
     160 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/Params/ValidateXS.pm
     151 /usr/local/lib/perl5/site_perl/5.8.8/Class/Data/Inheritable.pm
     147 /usr/local/lib/perl5/5.8.8/UNIVERSAL.pm
     136 /usr/local/lib/perl5/5.8.8/strict.pm
     131 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Screen.pm
     127 /Users/punkish/Sites/carbonmodel/app/_perl/Carbonmodel.pm
     100 /usr/local/lib/perl5/5.8.8/Digest/base.pm
      95 /usr/local/lib/perl5/5.8.8/darwin-2level/Config.pm
      93 /usr/local/lib/perl5/5.8.8/integer.pm
      88 /usr/local/lib/perl5/5.8.8/bytes.pm
      82 /usr/local/lib/perl5/5.8.8/vars.pm
      73 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/ErrorHandler.pm
      63 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Base.pm
      51 /usr/local/lib/perl5/5.8.8/warnings/register.pm
      418 /usr/local/lib/perl5/5.8.8/attributes.pm
      40 /usr/local/lib/perl5/5.8.8/locale.pm
      23 /usr/local/lib/perl5/site_perl/5.8.8/auto/Config/Simple/autosplit.ix
      13 /usr/local/lib/perl5/site_perl/5.8.8/auto/Config/Simple/verbose.al


   40848 total


So, 40K lines of code to create a fairly routine website, and that is
not counting any HTML/SQL/JavaScript and CSS. Granted, this is fairly
misleading as it includes formatting of lines, comments, etc., but
still... is this par for course for other frameworks as well?



--
Puneet Kishor

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Paul Miller-13 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Sep 15, 2009 at 12:10 PM, P Kishor <punk.kish@...> wrote:
> still... is this par for course for other frameworks as well?

other frameworks are much worse.

--
If riding in an airplane is flying, then riding in a boat is swimming.
114 jumps, 47.2 minutes of freefall, 90.4 freefall miles.

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Michael Graham :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


A bare Catalyst test app has about 87K lines.  

After you add all the plugins and support modules listed the tutorial
(DBIx::Class, Template Toolkit, Session, Authentication, Authorization,
FormFu) you're up to around 170K lines.


Michael


On Tue, 15 Sep 2009 11:10:31 -0500
P Kishor <punk.kish@...> wrote:

> Pursuant to the recent email about Titanium dependency hell, I was
> curious as to how big really was my tiny 20 line Perl index.cgi. So,
> with guidance from a couple of monks on PM, I add the following line
> to my script...
>
> END { system( 'wc', '-l', values %INC ) }
>
>
>  and got the following (I have reverse sorted them by number of lines
> of code)
>
>     7824 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBI.pm
>     3900 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Simple.pm
>     2449 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application.pm
>     1535 /usr/local/lib/perl5/site_perl/5.8.8/Config/Simple.pm
>     1473 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session.pm
>     1472 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/JSON/XS.pm
>     1434 /usr/local/lib/perl5/5.8.8/overload.pm
>     1299 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Dispatch.pm
>     1264 /usr/local/lib/perl5/5.8.8/darwin-2level/Data/Dumper.pm
>      891 /usr/local/lib/perl5/site_perl/5.8.8/Exception/Class.pm
>      872 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBD/SQLite.pm
>      851 /Users/punkish/Sites/carbonmodel/app/_perl/Authen.pm
>      833 /usr/local/lib/perl5/5.8.8/darwin-2level/DynaLoader.pm
>      716 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/Params/Validate.pm
>      614 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/LogDispatch.pm
>      604 /usr/local/lib/perl5/5.8.8/CGI/Carp.pm
>      566 /usr/local/lib/perl5/site_perl/5.8.8/Devel/StackTrace.pm
>      543 /usr/local/lib/perl5/site_perl/5.8.8/JSON/Any.pm
>      525 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/Session.pm
>      516 /usr/local/lib/perl5/5.8.8/darwin-2level/File/Spec/Unix.pm
>      497 /usr/local/lib/perl5/5.8.8/warnings.pm
>      456 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Simple/Util.pm
>      446 /usr/local/lib/perl5/site_perl/5.8.8/Crypt/GeneratePassword.pm
>      440 /usr/local/lib/perl5/5.8.8/Exporter.pm
>      437 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch.pm
>      376 /usr/local/lib/perl5/5.8.8/darwin-2level/Digest/MD5.pm
>      356 /usr/local/lib/perl5/5.8.8/Time/Local.pm
>      356 /usr/local/lib/perl5/5.8.8/darwin-2level/XSLoader.pm
>      343 /usr/local/lib/perl5/5.8.8/AutoLoader.pm
>      340 /usr/local/lib/perl5/5.8.8/constant.pm
>      336 /usr/local/lib/perl5/5.8.8/darwin-2level/File/Spec.pm
>      327 /usr/local/lib/perl5/site_perl/5.8.8/Exception/Class/TryCatch.pm
>      316 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/DBH.pm
>      301 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Output.pm
>      283 /usr/local/lib/perl5/5.8.8/darwin-2level/Scalar/Util.pm
>      274 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/JSON.pm
>      274 /usr/local/lib/perl5/5.8.8/Carp.pm
>      263 /usr/local/lib/perl5/5.8.8/Text/ParseWords.pm
>      259 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/File.pm
>      248 /usr/local/lib/perl5/5.8.8/Exporter/Heavy.pm
>      236 /usr/local/lib/perl5/5.8.8/darwin-2level/Fcntl.pm
>      235 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/Config/Simple.pm
>      233 /usr/local/lib/perl5/5.8.8/darwin-2level/List/Util.pm
>      226 /usr/local/lib/perl5/5.8.8/base.pm
>      214 /usr/local/lib/perl5/5.8.8/Class/ISA.pm
>      206 /usr/local/lib/perl5/5.8.8/darwin-2level/lib.pm
>      204 /usr/local/lib/perl5/site_perl/5.8.8/common/sense.pm
>      194 /usr/local/lib/perl5/site_perl/5.8.8/UNIVERSAL/require.pm
>      160 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/Params/ValidateXS.pm
>      151 /usr/local/lib/perl5/site_perl/5.8.8/Class/Data/Inheritable.pm
>      147 /usr/local/lib/perl5/5.8.8/UNIVERSAL.pm
>      136 /usr/local/lib/perl5/5.8.8/strict.pm
>      131 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Screen.pm
>      127 /Users/punkish/Sites/carbonmodel/app/_perl/Carbonmodel.pm
>      100 /usr/local/lib/perl5/5.8.8/Digest/base.pm
>       95 /usr/local/lib/perl5/5.8.8/darwin-2level/Config.pm
>       93 /usr/local/lib/perl5/5.8.8/integer.pm
>       88 /usr/local/lib/perl5/5.8.8/bytes.pm
>       82 /usr/local/lib/perl5/5.8.8/vars.pm
>       73 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/ErrorHandler.pm
>       63 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Base.pm
>       51 /usr/local/lib/perl5/5.8.8/warnings/register.pm
>       418 /usr/local/lib/perl5/5.8.8/attributes.pm
>       40 /usr/local/lib/perl5/5.8.8/locale.pm
>       23 /usr/local/lib/perl5/site_perl/5.8.8/auto/Config/Simple/autosplit.ix
>       13 /usr/local/lib/perl5/site_perl/5.8.8/auto/Config/Simple/verbose.al
>
>
>    40848 total
>
>
> So, 40K lines of code to create a fairly routine website, and that is
> not counting any HTML/SQL/JavaScript and CSS. Granted, this is fairly
> misleading as it includes formatting of lines, comments, etc., but
> still... is this par for course for other frameworks as well?
>
>
>


--
Michael Graham <magog@...>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by P Kishor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Sep 18, 2009 at 8:24 AM, Michael Graham <magog@...> wrote:
>
> A bare Catalyst test app has about 87K lines.
>
> After you add all the plugins and support modules listed the tutorial
> (DBIx::Class, Template Toolkit, Session, Authentication, Authorization,
> FormFu) you're up to around 170K lines.


Cool! So, I am convinced that CGI::App and its bundle of plug-ins is
rather svelte compared to, say, Catalyst. 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!

The other related issue is a single-piece install vs. lots of bits and
bobs. While the latter provides fine-grained control over what one
wants, lots of moving parts means lots of places things can go wrong.
I guess Titanium is a move toward that perception model of a
single-piece install, but Titanium is just a very thin skin holding a
lot of jingling jangling bones together.

Of course, a single-piece installation will presume certain
scaffolding for people, whether they like it or not, and provide
certain built-in ways of doing things, but if those ways meet the
needs of 80% of the people in an easy, single-click installation, one
piece to understand way, heck, we have 80% of customers as happy
customers, as happy spokespersons, etc.

One way to achieve this would be to simply squish all the various bits
and bobs into a single file and called CGI::Mongo. It will still be
40,000+ lines long, but heck, it would be a single file that will be
40,000+ lines long. The Perl interpreter will have to open only one
file on every invocation. Then, one can work on trimming what one
doesn't need.




>
>
> Michael
>
>
> On Tue, 15 Sep 2009 11:10:31 -0500
> P Kishor <punk.kish@...> wrote:
>
>> Pursuant to the recent email about Titanium dependency hell, I was
>> curious as to how big really was my tiny 20 line Perl index.cgi. So,
>> with guidance from a couple of monks on PM, I add the following line
>> to my script...
>>
>> END { system( 'wc', '-l', values %INC ) }
>>
>>
>>  and got the following (I have reverse sorted them by number of lines
>> of code)
>>
>>     7824 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBI.pm
>>     3900 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Simple.pm
>>     2449 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application.pm
>>     1535 /usr/local/lib/perl5/site_perl/5.8.8/Config/Simple.pm
>>     1473 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session.pm
>>     1472 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/JSON/XS.pm
>>     1434 /usr/local/lib/perl5/5.8.8/overload.pm
>>     1299 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Dispatch.pm
>>     1264 /usr/local/lib/perl5/5.8.8/darwin-2level/Data/Dumper.pm
>>      891 /usr/local/lib/perl5/site_perl/5.8.8/Exception/Class.pm
>>      872 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBD/SQLite.pm
>>      851 /Users/punkish/Sites/carbonmodel/app/_perl/Authen.pm
>>      833 /usr/local/lib/perl5/5.8.8/darwin-2level/DynaLoader.pm
>>      716 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/Params/Validate.pm
>>      614 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/LogDispatch.pm
>>      604 /usr/local/lib/perl5/5.8.8/CGI/Carp.pm
>>      566 /usr/local/lib/perl5/site_perl/5.8.8/Devel/StackTrace.pm
>>      543 /usr/local/lib/perl5/site_perl/5.8.8/JSON/Any.pm
>>      525 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/Session.pm
>>      516 /usr/local/lib/perl5/5.8.8/darwin-2level/File/Spec/Unix.pm
>>      497 /usr/local/lib/perl5/5.8.8/warnings.pm
>>      456 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Simple/Util.pm
>>      446 /usr/local/lib/perl5/site_perl/5.8.8/Crypt/GeneratePassword.pm
>>      440 /usr/local/lib/perl5/5.8.8/Exporter.pm
>>      437 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch.pm
>>      376 /usr/local/lib/perl5/5.8.8/darwin-2level/Digest/MD5.pm
>>      356 /usr/local/lib/perl5/5.8.8/Time/Local.pm
>>      356 /usr/local/lib/perl5/5.8.8/darwin-2level/XSLoader.pm
>>      343 /usr/local/lib/perl5/5.8.8/AutoLoader.pm
>>      340 /usr/local/lib/perl5/5.8.8/constant.pm
>>      336 /usr/local/lib/perl5/5.8.8/darwin-2level/File/Spec.pm
>>      327 /usr/local/lib/perl5/site_perl/5.8.8/Exception/Class/TryCatch.pm
>>      316 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/DBH.pm
>>      301 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Output.pm
>>      283 /usr/local/lib/perl5/5.8.8/darwin-2level/Scalar/Util.pm
>>      274 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/JSON.pm
>>      274 /usr/local/lib/perl5/5.8.8/Carp.pm
>>      263 /usr/local/lib/perl5/5.8.8/Text/ParseWords.pm
>>      259 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/File.pm
>>      248 /usr/local/lib/perl5/5.8.8/Exporter/Heavy.pm
>>      236 /usr/local/lib/perl5/5.8.8/darwin-2level/Fcntl.pm
>>      235 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/Config/Simple.pm
>>      233 /usr/local/lib/perl5/5.8.8/darwin-2level/List/Util.pm
>>      226 /usr/local/lib/perl5/5.8.8/base.pm
>>      214 /usr/local/lib/perl5/5.8.8/Class/ISA.pm
>>      206 /usr/local/lib/perl5/5.8.8/darwin-2level/lib.pm
>>      204 /usr/local/lib/perl5/site_perl/5.8.8/common/sense.pm
>>      194 /usr/local/lib/perl5/site_perl/5.8.8/UNIVERSAL/require.pm
>>      160 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/Params/ValidateXS.pm
>>      151 /usr/local/lib/perl5/site_perl/5.8.8/Class/Data/Inheritable.pm
>>      147 /usr/local/lib/perl5/5.8.8/UNIVERSAL.pm
>>      136 /usr/local/lib/perl5/5.8.8/strict.pm
>>      131 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Screen.pm
>>      127 /Users/punkish/Sites/carbonmodel/app/_perl/Carbonmodel.pm
>>      100 /usr/local/lib/perl5/5.8.8/Digest/base.pm
>>       95 /usr/local/lib/perl5/5.8.8/darwin-2level/Config.pm
>>       93 /usr/local/lib/perl5/5.8.8/integer.pm
>>       88 /usr/local/lib/perl5/5.8.8/bytes.pm
>>       82 /usr/local/lib/perl5/5.8.8/vars.pm
>>       73 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/ErrorHandler.pm
>>       63 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Base.pm
>>       51 /usr/local/lib/perl5/5.8.8/warnings/register.pm
>>       418 /usr/local/lib/perl5/5.8.8/attributes.pm
>>       40 /usr/local/lib/perl5/5.8.8/locale.pm
>>       23 /usr/local/lib/perl5/site_perl/5.8.8/auto/Config/Simple/autosplit.ix
>>       13 /usr/local/lib/perl5/site_perl/5.8.8/auto/Config/Simple/verbose.al
>>
>>
>>    40848 total
>>
>>
>> So, 40K lines of code to create a fairly routine website, and that is
>> not counting any HTML/SQL/JavaScript and CSS. Granted, this is fairly
>> misleading as it includes formatting of lines, comments, etc., but
>> still... is this par for course for other frameworks as well?
>>
>>
>>
>
>
> --
> Michael Graham <magog@...>
>




--
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://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Michael Peters :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

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.

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 :)

--
Michael Peters
Plus Three, LP

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by P Kishor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Very good points Michael. My response to some of them below --

On Fri, Sep 18, 2009 at 8:47 AM, Michael Peters <mpeters@...> 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.


> 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
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.


>
> --
> Michael Peters
> Plus Three, LP
>
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://www.erlbaum.net/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://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by gvimrc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael Graham wrote:

> A bare Catalyst test app has about 87K lines.  
>
> After you add all the plugins and support modules listed the tutorial
> (DBIx::Class, Template Toolkit, Session, Authentication, Authorization,
> FormFu) you're up to around 170K lines.
>
>
> Michael
>
>

The fact that Titanium isn't quite as bloated as Catalyst offers no comfort to anyone who turned to CGI::Application as an anitdote to Catalyst dependency hell. All I'm saying is that Titanium may be  heading in the same direction re dependencies which impacts deployment. I still haven't been able to get Titanium to install on  OS X 10.5.8 / Perl 5.8.8 due to a circular dependency on a module loader plugin.

gvim

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Stewart Heckenberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't care so much about dependencies but whether my code is easy to
write and maintain. For me that's about knowing where all the bodies
are buried, and by that I mean keeping the number of moving parts to a
minimum and not having a lot of scaffolding. That said,
CGI::Application trumps most other frameworks because at its heart
it's CGI and it's about using subs instead of epic if/else nests. I
don't even care if CGI::Application could be smaller in terms of lines
of code, because for me it's about being smaller conceptually, and
nothing to do with lines of code or memory/disk footprint. Anyway,
there's my in-depth analysis -- if anyone likes I can provide a really
nice looking chart or something to back up my "data" :D

2009/9/19 P Kishor <punk.kish@...>:

> Very good points Michael. My response to some of them below --
>
> On Fri, Sep 18, 2009 at 8:47 AM, Michael Peters <mpeters@...> 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.
>
>
>> 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
> 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.
>
>
>>
>> --
>> Michael Peters
>> Plus Three, LP
>>
>> #####  CGI::Application community mailing list  ################
>> ##                                                            ##
>> ##  To unsubscribe, or change your message delivery options,  ##
>> ##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
>> ##                                                            ##
>> ##  Web archive:   http://www.erlbaum.net/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://www.erlbaum.net/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
>
>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Ron Savage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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://www.erlbaum.net/mailman/listinfo/cgiapp    ##
> > ##                                                            ##
> > ##  Web archive:   http://www.erlbaum.net/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://www.erlbaum.net/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
>
>
--
Ron Savage
ron@...
http://savage.net.au/index.html



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Jolly.Tall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ron Savage wrote:
[..]

> #!/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";

Hi Ron, hey that's nice - I just used it to profile my current app. I
modified it slightly to make it a bit less painful on the eyes (though I
haven't managed to get rid of the line noise in the 'for' block yet) and
introduced a files counter and an average lines/file function:

#-----------------------------------------
use strict;
use warnings;

use IO::All;
use File::Find;

my $lines = my $files = 0;

my $dir = shift || "Usage: $0 <dir.name>";
find(\&found, $dir);

sub found {
   return if (-d $_ || ! -T $_);

   $files++;
   for ( io($_)->slurp ) {
     s/^\s+|\s+$//;
     next if /^$|^[#{}]/;
     $lines++;
}

print "File count: $files\n";
print "Line count: $lines\n";
print "Average lines / file = " . int ($lines / $files) . "\n";

#-----------------------------------------

I'm also playing with the 'next if' line to exempt single-line blocks eg
{ do_something() if $foo } which are currently skipped using ^[#{}]
--
Richard Jones

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Ron Savage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Richard

On Sat, 2009-09-19 at 10:49 +0100, Richard Jones wrote:
> Ron Savage wrote:
[snip]
> Hi Ron, hey that's nice - I just used it to profile my current app. I
> modified it slightly to make it a bit less painful on the eyes (though I


You can't be serious. My code may not be perfect, but it's clear what
it's doing...

--
Ron Savage
ron@...
http://savage.net.au/index.html



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Jolly.Tall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ron Savage wrote:

> Hi Richard
>
> On Sat, 2009-09-19 at 10:49 +0100, Richard Jones wrote:
>> Ron Savage wrote:
> [snip]
>> Hi Ron, hey that's nice - I just used it to profile my current app. I
>> modified it slightly to make it a bit less painful on the eyes (though I
>
>
> You can't be serious. My code may not be perfect, but it's clear what
> it's doing...

Yep, though I didn't claim mine was either (just personal preferences at
work here, and the temptation to hack to see what can be done), and the
use of IO::All in place of manual file handling.

And this also works for me:

$lines += grep { s/^\s+|\s+$//; $_ !~ /^[{}]?$|^#/; } io($_)->chomp->slurp;

though it's still horribly noisy in the grep block (can that be
improved?), and doesn't exempt content between =begin & =cut blocks.
--
Richard Jones

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Rhesa Rozendaal-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Richard Jones wrote:

> Ron Savage wrote:
>> Hi Richard
>>
>> On Sat, 2009-09-19 at 10:49 +0100, Richard Jones wrote:
>>> Ron Savage wrote:
>> [snip]
>>> Hi Ron, hey that's nice - I just used it to profile my current app. I
>>> modified it slightly to make it a bit less painful on the eyes (though I
>>
>> You can't be serious. My code may not be perfect, but it's clear what
>> it's doing...
>
> Yep, though I didn't claim mine was either (just personal preferences at
> work here, and the temptation to hack to see what can be done), and the
> use of IO::All in place of manual file handling.
>
> And this also works for me:
>
> $lines += grep { s/^\s+|\s+$//; $_ !~ /^[{}]?$|^#/; } io($_)->chomp->slurp;
>
> though it's still horribly noisy in the grep block (can that be
> improved?), and doesn't exempt content between =begin & =cut blocks.


An approach using PPI would produce more useful results. See
http://search.cpan.org/perldoc?countperl for example.

Here's the output for CGI/Application.pm:


$ countperl /opt/perl/lib/site_perl/5.10.0/CGI/Application.pm

Perl files found:                1

Counts
------
total code lines:        482
lines of non-sub code:   14
packages found:          1
subs/methods:            34

Subroutine/Method Size
----------------------
min:                  1 lines
max:                  39 lines
mean:                 13.76 lines
std. deviation:       9.97
median:               12.00

McCabe Complexity
-----------------
Code not in any subroutine::
min:                  1
max                   1
mean:                 1.00
std. deviation:       0.00
median:               1.00

Subroutines/Methods:
min:                  1
max:                  16
mean:                 4.53
std. deviation:       4.20
median:               3.50

[Tab-delimited list of subroutines omitted]

As you can see, CGI::Application is in good shape with only 482 lines of
actual code, 34 subs or methods, and a good size and complexity per method.

rhesa

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by P Kishor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Sep 19, 2009 at 9:15 AM, Rhesa Rozendaal <perl@...> wrote:

> Richard Jones wrote:
>>
>> Ron Savage wrote:
>>>
>>> Hi Richard
>>>
>>> On Sat, 2009-09-19 at 10:49 +0100, Richard Jones wrote:
>>>>
>>>> Ron Savage wrote:
>>>
>>> [snip]
>>>>
>>>> Hi Ron, hey that's nice - I just used it to profile my current app. I
>>>> modified it slightly to make it a bit less painful on the eyes (though I
>>>
>>> You can't be serious. My code may not be perfect, but it's clear what
>>> it's doing...
>>
>> Yep, though I didn't claim mine was either (just personal preferences at
>> work here, and the temptation to hack to see what can be done), and the use
>> of IO::All in place of manual file handling.
>>
>> And this also works for me:
>>
>> $lines += grep { s/^\s+|\s+$//; $_ !~ /^[{}]?$|^#/; }
>> io($_)->chomp->slurp;
>>
>> though it's still horribly noisy in the grep block (can that be
>> improved?), and doesn't exempt content between =begin & =cut blocks.
>
>
> An approach using PPI would produce more useful results. See
> http://search.cpan.org/perldoc?countperl for example.
>
> Here's the output for CGI/Application.pm:
>
>
> $ countperl /opt/perl/lib/site_perl/5.10.0/CGI/Application.pm
>
> Perl files found:                1
>
> Counts
> ------
> total code lines:        482
> lines of non-sub code:   14
> packages found:          1
> subs/methods:            34
>
> Subroutine/Method Size
> ----------------------
> min:                  1 lines
> max:                  39 lines
> mean:                 13.76 lines
> std. deviation:       9.97
> median:               12.00
>
> McCabe Complexity
> -----------------
> Code not in any subroutine::
> min:                  1
> max                   1
> mean:                 1.00
> std. deviation:       0.00
> median:               1.00
>
> Subroutines/Methods:
> min:                  1
> max:                  16
> mean:                 4.53
> std. deviation:       4.20
> median:               3.50
>
> [Tab-delimited list of subroutines omitted]
>
> As you can see, CGI::Application is in good shape with only 482 lines of
> actual code, 34 subs or methods, and a good size and complexity per method.
>

yes, but... I do realize that the perl interpreter likely tosses the
comments before compiling the code, but isn't there a penalty in
opening a large file, even if most of it is comments? A thousand line
file with 999 lines of comments and one line of code will still need
to be parsed, and it wouldn't matter where in the file the code is,
beginning or end. Perl will have to go through the entire file to
determine what is what.

Now, of course, with 999 lines it probably makes a difference of a few
milliseconds, or not even that, but with 40,000 lines it might be a
different story. Now, keep in mind, it does seem that CGI::App and its
various parts are a lot less than competing frameworks, but 40K lines
scattered over 40-50 odd files means that all those 40-50 files have
to be opened up on every single hit, parsed, and compiled. A few extra
milliseconds here and there would add up over many concurrent hits. Of
course, that is a perfect condition when it makes sense to introduce a
persistent environment such as FastCGI or mod_perl, but they have
other complexities in installation and implementation.

Actually, truth be told, I really don't even have much against the
number of lines. It is in the partially perceived and partially real
difficulty in installing a multitude of interdependent modules just to
get what seems like a simple thing but in reality is quite a
complicated thing... a "simple" db driven website. I use
HTML::Template, so I don't even use CGI::Simple (let alone CGI) for
anything other than $foo = $cgi->param('foo') kind of stuff.

Any move toward making a one click, transparent installation that
brings together templating, db (sqlite, most obviously) and a
persistent environment and a simple but robust web server would likely
gather a lot of brainshare, much like Ruby on Rails has. A
transportable installation would also make it possible for us to make
applications that can simply be copied to a new computer and run.




> rhesa
>






--
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://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Ron Savage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rhesa

On Sat, 2009-09-19 at 16:15 +0200, Rhesa Rozendaal wrote:
> An approach using PPI would produce more useful results. See
> http://search.cpan.org/perldoc?countperl for example.

Very nice! This gives me an incentive to install PPI...

--
Ron Savage
ron@...
http://savage.net.au/index.html



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Ron Savage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Richard

On Sat, 2009-09-19 at 13:11 +0100, Richard Jones wrote:
> Yep, though I didn't claim mine was either (just personal preferences at
> work here, and the temptation to hack to see what can be done), and the
> use of IO::All in place of manual file handling.

Nothing wrong with personal preferences, especially if they're
mine :-)).

> And this also works for me:
>
> $lines += grep { s/^\s+|\s+$//; $_ !~ /^[{}]?$|^#/; } io($_)->chomp->slurp;

Errr. What happens with a line which has /both/ leading and trailing
spaces?

--
Ron Savage
ron@...
http://savage.net.au/index.html



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Ron Savage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rhesa

On Sat, 2009-09-19 at 16:15 +0200, Rhesa Rozendaal wrote:
> As you can see, CGI::Application is in good shape with only 482 lines of
> actual code, 34 subs or methods, and a good size and complexity per method.

That's a great argument for shipping the POD in a separate file from the
*.pm.

--
Ron Savage
ron@...
http://savage.net.au/index.html



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by Michael Peters :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 09/19/2009 07:10 PM, Ron Savage wrote:

> That's a great argument for shipping the POD in a separate file from the
> *.pm.

For me the benefit of having the documentation near the code it
documents (which means it has a higher chance of staying up-to-date) far
outweighs the micro (or pico) seconds I'll save by the interpreter
skipping my comments when it's compiling. I'm still waiting for someone
in this thread that is concerned with these issues to actually do a
benchmark.

Also, if you run a persistant environment (and I still don't understand
why everyone doesn't do that) it's all moot anyway.

--
Michael Peters
Plus Three, LP

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by P Kishor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Sep 19, 2009 at 7:35 PM, Michael Peters <mpeters@...> wrote:

> On 09/19/2009 07:10 PM, Ron Savage wrote:
>
>> That's a great argument for shipping the POD in a separate file from the
>> *.pm.
>
> For me the benefit of having the documentation near the code it documents
> (which means it has a higher chance of staying up-to-date) far outweighs the
> micro (or pico) seconds I'll save by the interpreter skipping my comments
> when it's compiling. I'm still waiting for someone in this thread that is
> concerned with these issues to actually do a benchmark.
>
> Also, if you run a persistant environment (and I still don't understand why
> everyone doesn't do that) it's all moot anyway.

Because, Michael, it is difficult. It is not simply out of the box and
click and run. To run a persistent environment, I have to install and
configure Apache and mod_perl or FastCGI. I develop on my laptop,
then, when everything is working, I set up the application on a test
server, then when everything is checked by the rest of the team and
tested, we move it to a production server. That means, I have to set
up not one but three identical environments. I have wasted countless
hours trying to make mod_perl compile on a server I have. It just is
too difficult.

Of course, this brings me back to the original intent behind this
thread... make the persistent environment, the database, the
templating engine, etc. a single click install, preferably a single
file instead of 40 different files, and I probably wouldn't even care
that it was 40K lines. I wouldn't even know... it is a matter of
perception, I guess.

Call my argument silly and stupid, but all these bits and bobs and
moving parts are scary, and folks looking over my shoulder say... do
we really need all this just to make a web page? Of course we do, but
do we have to show them (and ourselves) that?

By the way, I agree with you wholeheartedly that the documentation
should be *with* the code. But, perhaps, like I mentioned in an
earlier email, we could have a "production" version of the code that
takes out all the comments, smushes all the code in a single file and
minifies it (aka "packs" it) a la Javascript minification... at least
for the tried and tested modules. Actually, I see a few drawbacks in
my own suggestion, but I put it out as a point of discussion.

>
> --
> Michael Peters
> Plus Three, LP
>




--
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://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: size of scripts and dependencies

by CosmicPerl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

P Kishor wrote:

> Of course, this brings me back to the original intent behind this
> thread... make the persistent environment, the database, the
> templating engine, etc. a single click install...[cut]
> By the way, I agree with you wholeheartedly that the documentation
> should be *with* the code. But, perhaps, like I mentioned in an
> earlier email, we could have a "production" version of the code that
> takes out all the comments, smushes all the code in a single file and
> minifies it (aka "packs" it) a la Javascript minification... at least
> for the tried and tested modules. Actually, I see a few drawbacks in
> my own suggestion, but I put it out as a point of discussion.
>  

I have a currently shelved project that aims to accomplish much of this
kind of thing. I call it the Perl scriptable install, one day soon I'll
hopefully get chance to write it :/


Lyle


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

< Prev | 1 - 2 | Next >