Keary gave me
> Some pointers:
> 
> > if ( scalar @ARGV > 0 )
> > { @testList = @ARGV;
> > }
> 
> The use of "scalar" here is superfluous "if" and "==" force a scalar
> context.

I am aware of that, but I still have trouble keeping track of what
contexts do what to which. Still kind of new to perl, tend to use more
than two or three languages in the course of a week, and even have days
I don't really look at code. Hard to keep track of everything, so I was just
making sure I said what I thought I said. Trying to, anyway. <grimace/>

> > if ( $level =~ m/^1.*/ )
> > { push @testList, @originalTopPagePlusFlack;
> > }
> 
> Note that this will match if $level is 10-19, 100+ etc as well. Your
> original test ($level == 1) is more reliable.

Actually, I probably shouldn't even be using numbers for this command
line parameter. So, even though using the numeric comparison here is
more accurate for the numbers, I want to leave structure that allows
text instead. 

Anyway, in this case it's a context where trailing text is a don't-care.

> > elsif ( $level =~ m/^2.*/ )
> > { push @testList, @anotherTopPagePlusFlack;
> > }
> 
> Same as above.
> 
> > elsif ( scalar @ARGV == 0 ) # still feels funny
> > { @testList = @basicTopPage;
> > }
> 
> Same as first.

This is actually where things got weird. I needed a case to distinguish
between a zero level and no level parameter at all for one operation, 
and there were some subtle interdependencies that I was trying to 
optimize away. I was trying to avoid running almost identical tests for 
two separate operations, which of course is not always a good idea.

> > elsif ( $level =~ m/^0.*/ ) # 0
> > { push @testList, @basicTopPage;
> > }
> 
> This could simply be $level == 0, unless $level *must* begin with a zero.
> Remember that all of these values of $level would be true considering $level
> == 0: "sljkhfglkjh" "" "0" "0sfjksh" hjdf45lkdjsf098" undef

Exactly.

This tool actually should evolve in a way that this command line
parameter will disappear, but, it might not. So I'm trying to leave it
in as stable condition as possible, trying to foresee the directions it
might evolve without me.

Thanks for the thoughts, Keary.

(I guess I should post more of my code when I have questions.)

-- 
Joel Rees <[EMAIL PROTECTED]>

Reply via email to