Paul Johnson <[email protected]> writes:
> On Sun, Feb 01, 2015 at 09:56:39AM -0500, Harry Putnam wrote:
>> Robert Wohlfarth <[email protected]> writes:
>>
>> > On Sat, Jan 31, 2015 at 3:58 PM, Harry Putnam <[email protected]> wrote:
>> >
>> > I have about 100 lines or so inside a File::Find:
>
> You will likely help yourself out a lot with not only this problem but
> others that you don't yet know about if you:
>
> 1. Split those 100 lines out into a separate subroutine.
> 2. Break that 100 line subroutine into at least four or five smaller
> subroutines.
>
I really did this all wrong... I actually have about another hundred
lines in subroutines too.
Where I really screwed up was to just keep coding, coding while the
spirit moved me instead of testing smaller less complete models as I
went. The way I did it, I ended up with this big pile of totally
untested code, and now faced with finding a problem that would. no
doubt, have surfaced way back down the road.
[...]
>> I did notice that before posting, and try removing it, but received
>> exactly the same error. So something is still going on somewhere
>> else.
>
> That may well be, but the semi-colon is an error, and the only one we
> can see in the code you have posted.
>
> $ perl -ce 'find ( sub {}, $tdir; )'
> syntax error at -e line 1, near "$tdir;"
> -e had compilation errors
> $ perl -ce 'find ( sub {}, $tdir )'
> -e syntax OK
Oh, I didn't mean to convey that I doubted it being wrong. Just
pointing out that something deeper yet is going on too.
Thanks for the nifty command line test.
I think it's time I started rewritting this thing using a different
plan. One where I test it every little ways, might also help me see
how to break it down into more subroutines.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/