-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 G'day Damyan and Mark,
Damyan Ivanov wrote: > You may want to join forces with Paul Fenwick (cc-ed) who intented to > do some incremental de-uglification. Paul, you mentioned a Git > repository, any chance to get it published? Done. The repo can be found at: http://github.com/pfenwick/dh-make-perl/tree/master Files and changes can be browsed on that page, as well as instructions on cloning the repo should you wish to do so. My changes are based on r26959 from svn. Commit access provided upon request; you'll need a (free) github account to make direct commits. Presently all I've done is reformat dh-make-perl using perltidy and the Perl Best Practices recommended tidyfile which can be found at http://www.perlmonks.org/?node_id=485885 . Unless perltidy has booched, all changes should be non-significant whitespace and comments only. But now that I'm thinking about this, I should talk about testing. Sorry for hijacking us off beautification. Very broadly, most CPAN modules have tests in a t/ directory, and work by loading up a module and testing individual subroutines inside. For applications, traditionally they create an App::Something module, and the actual application is just a thin wrapper around this. Examines include App::Ack (a better grep), and App::SweeperBot (which plays Windows minesweeper for you). However dh-make-perl has everything in one great big file, which takes testing of subroutines hard. When we load dh-make-perl into perl, it actually wants to run the application; for testing we want to poke and prod individual subroutines and sections of code, and make sure they work as they expect. At the moment, unit testing for dh-make-perl is hard. Now, we *could* build App::Dh_make_perl, and while I think this is a good idea, it represents a large structural change from what we have right now. So instead, I'd like to suggest a different approach. We wrap the entire "main" program that usually runs when dh-make-perl is invoked inside an actual "sub main { }", just like would in C. We then have a tiny snippet of code that tests if $0 (our program name) is equal to __FILE__ (our filename). If they're the same, we're running dh-make-perl as a program, and invoke it by calling our main subroutine. If they're different, we're loading it as a module (probably for testing), and do nothing. The big advantage here is that we can do actually do unit testing, but it should also highlight any areas of strong coupling in the code. Since all the main code will be inside its own lexical scope, any variables that were previously "shared" between subroutines and the main program should be caught by strict, and the code can then be adjusted to pass these in explicitly. This in turn makes the code easier to test and maintain. Unfortunately for me, I've hit a huge crunch in my timetable, so I won't get a chance to do any of this soon. Next week is working on my presentation for the Open Source Developers' Conference[1], where I'll be talking about Perl's new autodie[2] pragma. Then there is the actual conference (interstate), and after that I'm teaching for two weeks (also interstate), and then it's Christmas. What this means is that you shouldn't be waiting on me in the short-term. I really, truly want dh-make-perl to use META.yml more, because it solves a huge number of my headaches, especially for modules that I directly or indirectly maintain. However I'm not likely to feel those headaches again until after Christmas. Cheerio, Paul [1] http://www.osdc.com.au/ [2] http://search.cpan.org/perldoc?autodie and http://perltraining.com.au/tips/2008-08-20.html - -- Paul Fenwick <[EMAIL PROTECTED]> | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFJKTGCx5N6j7FHnlURAsN3AJ4gHmEMzfFS7E/M55q6/2opWBFFmwCfasYc 9Z+dGQxudgjEDoFzk5b2IHk= =08eY -----END PGP SIGNATURE----- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]