You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2001/12/14 05:14:34 UTC

[patch] use catfile instead of join '/'

- make WrapXS more portable

Index: lib/ModPerl/WrapXS.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v
retrieving revision 1.37
diff -u -r1.37 WrapXS.pm
--- lib/ModPerl/WrapXS.pm	2001/12/14 04:10:20	1.37
+++ lib/ModPerl/WrapXS.pm	2001/12/14 04:12:24
@@ -11,6 +11,7 @@
 use File::Path qw(rmtree mkpath);
 use Cwd qw(fastcwd);
 use Data::Dumper;
+use File::Spec::Functions qw(catfile);

 our $VERSION = '0.01';

@@ -220,7 +221,7 @@
 sub prepare {
     my $self = shift;
     $self->{DIR} = 'WrapXS';
-    $self->{XS_DIR} = join '/', fastcwd(), 'xs';
+    $self->{XS_DIR} = catfile fastcwd(), 'xs';

     if (-e $self->{DIR}) {
         rmtree([$self->{DIR}], 1, 1);
@@ -242,7 +243,7 @@

     my $dirname = $self->class_dirname($class);
     my $dir = ($dirname =~ m:/: and $dirname !~ m:^$self->{DIR}:) ?
-      join('/', $self->{DIR}, $dirname) : $dirname;
+      catfile($self->{DIR}, $dirname) : $dirname;

     mkpath [$dir], 1, 0755 unless -d $dir;

@@ -251,7 +252,7 @@

 sub class_file {
     my($self, $class, $file) = @_;
-    join '/', $self->class_dir($class), $file;
+    catfile $self->class_dir($class), $file;
 }

 sub cname {
@@ -544,7 +545,7 @@

     $method = $method . '_code';
     my($h, $code) = $self->typemap->$method();
-    my $file = join '/', $self->{XS_DIR}, $h;
+    my $file = catfile $self->{XS_DIR}, $h;

     open my $fh, '>', $file or die "open $file: $!";
     print $fh $self->ModPerl::Code::noedit_warning_c(), "\n";



_____________________________________________________________________
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://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [patch] use catfile instead of join '/'

Posted by Doug MacEachern <do...@covalent.net>.
On Fri, 14 Dec 2001, Stas Bekman wrote:

> - make WrapXS more portable

+1


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org