httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: cvs commit: httpd-apreq-2/build xsbuilder.pl
Date Fri, 13 Jun 2003 01:23:35 GMT
Randy Kobes wrote:
> On Thu, 12 Jun 2003, Stas Bekman wrote:
> 
> [ .. ]
> 
>>Understood. But using FindBin is better than Cwd in general, I
>>believe, because it allows you to invoke the same script as
>>foo/bar.pl ./bar.pl or even /full/path/to/bar.pl and using
>>FindBin it'll always do the right thing, whereas it won't with
>>Cwd.
>>
>>so perhaps doing Win32::GetLongPathName($FindBin::Bin) works?
> 

> Yes, it does, and that's a good point - thanks. How about
> (for both build/xsbuilder.pl and glue/perl/t/TEST.PL):

+1, but I'd also suggest to rename $cwd with something more intuitive, since 
this isn't really a cwd. e.g. we can easily get the root dir, since that's 
what we really want, instead of doing the regex hack.

Perhaps something like this for build/xsbuilder.pl

use FindBin;
use File::Spec::Functions qw(updir)
my $base_dir = updir(Apache::Build::WIN32 ?
     Win32::GetLongPathName($FindBin::Bin) : $FindBin::Bin);
die "Can't find base cvs directory" unless $base_dir =~ /httpd-apreq-2/;

this is however untested.

in the case of glue/perl/t/TEST.PL we need to go 3 dirs up.

> ===============================================================
> Index: build/xsbuilder.pl
> ===================================================================
> RCS file: /home/cvs/httpd-apreq-2/build/xsbuilder.pl,v
> retrieving revision 1.6
> diff -u -r1.6 xsbuilder.pl
> --- build/xsbuilder.pl	12 Jun 2003 05:55:32 -0000	1.6
> +++ build/xsbuilder.pl	12 Jun 2003 14:23:01 -0000
> @@ -10,9 +10,9 @@
>  use Apache::Build;
>  require Win32 if Apache::Build::WIN32;
> 
> -use Cwd;
> +use FindBin;
>  my $cwd = Apache::Build::WIN32 ?
> -    Win32::GetLongPathName(cwd) : cwd;
> +    Win32::GetLongPathName($FindBin::Bin) : $FindBin::Bin;
>  $cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
>  my $base_dir = $1;
>  my $src_dir = "$base_dir/src";
> Index: glue/perl/t/TEST.PL
> ===================================================================
> RCS file: /home/cvs/httpd-apreq-2/glue/perl/t/TEST.PL,v
> retrieving revision 1.2
> diff -u -r1.2 TEST.PL
> --- glue/perl/t/TEST.PL	12 Jun 2003 05:42:13 -0000	1.2
> +++ glue/perl/t/TEST.PL	12 Jun 2003 14:23:01 -0000
> @@ -7,9 +7,9 @@
>  use Apache::Build;
>  require Win32 if Apache::Build::WIN32;
> 
> -use Cwd;
> +use FindBin;
>  my $cwd = Apache::Build::WIN32 ?
> -    Win32::GetLongPathName(cwd) : cwd;
> +    Win32::GetLongPathName($FindBin::Bin) : $FindBin::Bin;
>  $cwd =~ m{^(.+httpd-apreq-2)} or die "Can't find base cvs directory";
>  my $base_dir = $1;
>  my $env_dir = "$base_dir/env";
> ===================================================================
> 


-- 


__________________________________________________________________
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


Mime
View raw message