You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@ectoplasm.org> on 2004/08/19 08:22:23 UTC
[Patch mp2] $r->content_languages
I've just finished adding back $r->content_languages to mp2.
Worth noting is the 2 util functions to convert to and from AV <->
apr_array_header_t
I believe there are a few other struct members that are of type
apr_array_header_t and
are currently not handled. I'll get those later.
Gozer out.
Re: [Patch mp2] $r->content_languages
Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Stas Bekman wrote:
> Philippe M. Chiasson wrote:
>
>> I've just finished adding back $r->content_languages to mp2.
>>
>> Worth noting is the 2 util functions to convert to and from AV <->
>> apr_array_header_t
>>
>> I believe there are a few other struct members that are of type
>> apr_array_header_t and
>> are currently not handled. I'll get those later.
>
>
> gozer++
>
> +1, sans a few minor formatting issues below :)
>
> and I suppose the doc is on the way, right? if not add an entry to
> api_status and turn the V flag down. :)
Correct. The doc is also on the way ;-)
>> Index: src/modules/perl/modperl_util.c
>
>
>> +apr_array_header_t *modperl_avrv2apr_array_header(pTHX_ apr_pool_t
>> *p, SV *avrv)
>
>
> line too long
>
>> +{
>> + AV *av;
>> + apr_array_header_t *array;
>> + int i, av_size;
>> + + if (!(SvROK(avrv) && (SvTYPE(SvRV(avrv)) == SVt_PVAV))) {
>> + Perl_croak(aTHX_ "Not an array reference");
>> + }
>> + + av = (AV*)SvRV(avrv);
>> + av_size = av_len(av);
>> + array = apr_array_make(p, av_size+1, sizeof(char *));
>> + + for(i = 0; i <= av_size; i++) {
>
> ^^^^^^ space
>
>
> > Index: t/response/TestAPI/request_rec.pm
> > ===================================================================
>
> > + # content_languages
> > + {
> > + my $l = [qw(fr-ca en-ca en-us)];
> > + ok t_cmp $r->content_languages, [], '$r->content_languages';
> > + ok t_cmp $r->content_languages($l), [],
> '$r->content_languages';
> > + ok t_cmp $r->content_languages, $l, '$r->content_languages';
> > +
> > + eval { $r->content_languages({}) };
> > + ok t_cmp $@, qr/Not an array reference/,
> > + '$r->content_languages(invalid)';
> > + }
>
> But won't it better to make the test more real, by getting the client
> side send a real C-L header? or is this one sent only by the server, I
> don't remember?
Yes, this one is sent by the server to indicate what language a certain
entity is in. You can control these with AddLanguage DefaultLanguage,
etc. I've adjusted the tests accdordingly.
Re: [Patch mp2] $r->content_languages
Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> I've just finished adding back $r->content_languages to mp2.
>
> Worth noting is the 2 util functions to convert to and from AV <->
> apr_array_header_t
>
> I believe there are a few other struct members that are of type
> apr_array_header_t and
> are currently not handled. I'll get those later.
gozer++
+1, sans a few minor formatting issues below :)
and I suppose the doc is on the way, right? if not add an entry to
api_status and turn the V flag down. :)
> Index: src/modules/perl/modperl_util.c
> +apr_array_header_t *modperl_avrv2apr_array_header(pTHX_ apr_pool_t *p, SV *avrv)
line too long
> +{
> + AV *av;
> + apr_array_header_t *array;
> + int i, av_size;
> +
> + if (!(SvROK(avrv) && (SvTYPE(SvRV(avrv)) == SVt_PVAV))) {
> + Perl_croak(aTHX_ "Not an array reference");
> + }
> +
> + av = (AV*)SvRV(avrv);
> + av_size = av_len(av);
> + array = apr_array_make(p, av_size+1, sizeof(char *));
> +
> + for(i = 0; i <= av_size; i++) {
^^^^^^ space
> Index: t/response/TestAPI/request_rec.pm
> ===================================================================
> + # content_languages
> + {
> + my $l = [qw(fr-ca en-ca en-us)];
> + ok t_cmp $r->content_languages, [], '$r->content_languages';
> + ok t_cmp $r->content_languages($l), [], '$r->content_languages';
> + ok t_cmp $r->content_languages, $l, '$r->content_languages';
> +
> + eval { $r->content_languages({}) };
> + ok t_cmp $@, qr/Not an array reference/,
> + '$r->content_languages(invalid)';
> + }
But won't it better to make the test more real, by getting the client side
send a real C-L header? or is this one sent only by the server, I don't
remember?
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org