perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: Compat implementations of method_register and server_root_relative in tests ?
Date Mon, 09 Aug 2004 21:37:57 GMT
Philippe M. Chiasson wrote:
> 
> 
> Stas Bekman wrote:
> 
>> Philippe M. Chiasson wrote:
>>
>>
>>> Index: lib/Apache/compat.pm
>>> ===================================================================
>>> RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
>>> retrieving revision 1.114
>>> diff -u -I$Id -r1.114 compat.pm
>>> --- lib/Apache/compat.pm    24 Jul 2004 07:27:03 -0000    1.114
>>> +++ lib/Apache/compat.pm    9 Aug 2004 21:10:04 -0000
>>> @@ -249,8 +249,13 @@
>>> package Apache;
>>>
>>> sub server_root_relative {
>>> -    my $class = shift;
>>> -    File::Spec->catfile(Apache::ServerUtil::server_root, @_);
>>> +    my ($class, $path, @extra) = @_;
>>> +    if (defined($path) && File::Spec->file_name_is_absolute($path))
{
>>> +        return File::Spec->catfile($path, @extra); +    }
>>> +    else {
>>> +        File::Spec->catfile(Apache::ServerUtil::server_root, $path, 
>>> @extra);
>>> +    }
>>> }
>>
>>
>>
>> How about:
>>
>> sub server_root_relative {
>>      my $class = shift;
>>      if (@_ && defined($_[0]) && 
>> File::Spec->file_name_is_absolute($_[0])) {
>>          return File::Spec->catfile(@_);
>>      }
>>      else {
>>          File::Spec->catfile(Apache::ServerUtil::server_root, @_);
>>      }
>> }
> 
> 
> Works for me ;-)

the point is that I haven't checked when you try to pass empty lists 
with commas, so keeping @_ intact makes it simple :)

> Shall I check it in =;l-?

Qui monsieur


-- 
__________________________________________________________________
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


Mime
View raw message