On 10/21/2016 05:30 AM, David Cantrell wrote:
> Commit regularly, commit often, don't be afraid to revert or to git
> reset --hard :-)

Agreed.


> I have some rather alarming intra-distribution module dependency
> problems in one of my dists - Number-Phone - but seem to muddle through
> OK. Debugging when I break part of it can be a bit of a pig though.

I'm still wrestling with techniques for avoiding circular dependencies,
but these ideas seem promising so far:

1.  Split subroutines with non-trivial functionality into two or more
subroutines: one at a low dependency level with minimum functionality,
and others with increasing dependency levels and functionality.  I
believe 'use constant...' creates quintessential zero-dependency
subroutines.

2.  Split modules with multiple subroutines of effectively different
dependency levels into multiple modules, each containing only
subroutines of the same dependency level.

3.  Find the right balance when applying the above principles.  Too
little risks circular dependencies, or hacks to avoid such.  Too much
creates an elephant in the living room.


> If I followed my own advice (which of course I don't - I don't practice
> what I preach because I'm ~~better than the people I'm preaching to~~
> ~~not the sort of person I'm preaching to~~ lazy) then my tests would be
> proper unit tests which rigourously mock each little bit of code's
> interactions with others, thus making the whole problem go away. I even
> wrote a little ball of Scary to help with that:
>   https://metacpan.org/pod/Class::Mock::Generic::InterfaceTester

Code for testing code can be a good thing, so long as it is of the
highest dependability.  Bugs in testing code are a nasty surprise:

    https://rt.cpan.org/Public/Bug/Display.html?id=118235


Capturing STDOUT and STDERR in Perl is something that I've struggled
with for many years.  Apparently, so have highly-qualified Perl
programmers.  Capture::Tiny seems to work, but I have yet to understand
what happens between print, system, warn, etc., and the OS -- the people
who talk about Perl internals have successfully frightened me into not
looking.


David

Reply via email to