httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: t/modules/rewrite tweaking
Date Wed, 08 Aug 2001 02:28:24 GMT
On Tue, 7 Aug 2001, john sachs wrote:

> hi,

> first let me explain the test a little. in this section of code, i am
> testing the 'rnd' rewriting functionality which takes a text file like
> this:
>
> 1 one|two|three|four|five|six
> 2 two|three|four|five|six
>
> and rewrites the key randomly to one of the possibilities you've given
> it.  in the test, the expected outcome is something between the number
> you're requesting and 6 which is max.  therefore the code:
>
> ok ($r =~ /^[$r-6]$/);
>
> the problem is i didnt take into account the condition you've run into
> where $r is a chunk of text with special characters in it.  i will
> have to somehow check for this case before i go blindly dumping it
> into the regexp.

OK, so why not to do: /^[1-6]$/ ?

I'd do it even more flexible:

my $pat = join '', @num;
/^[$pat]$/

so now you can change @num and not to worry about forgetting adjusting the
code.

> as a side note, i think you're getting this error because your
> particular build of apache does not contain mod_rewrite.  very soon,
> the test will tell you its not going to run on your platform...heh.
> i plan to talk to doug about this today.

Well, I did enable rewrite, see my original post. But I was running httpd
2.0, so may be it's not the same.

In any case, your code was good, but it'd didn't do initializations in
every place it should and didn't check for whether variables are defined
before using them. Something that's not acceptible with warnings mode that
you use. You didn't see any problems because the test has been completely
working for you, but if something goes wrong (which is what the test is
designed for) it was immediately dying without proceeding, on the first
warning, because warnings are fatal.

Please consider using parts of my patch, at least those parts where I've
added various initializations and checks. I guess you should try to
compile httpd with no mod_rewrite and see how it fails. Which can be a
case if it doesn't work properly.

Also it'd be nice that we all follow the same ident style, which is 4
spaces (no tabs!) in the Perl code. thanks :)

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Mime
View raw message