Subject: | [PATCH] help can_run() on VMS |
Hi,
This patch helps IPC::Cmd::can_run() on VMS:
--- Cmd.pm.orig Fri Jan 21 21:55:01 2005
+++ Cmd.pm Fri Jan 21 22:14:39 2005
@@ -21,8 +21,8 @@
$VERSION = '0.24';
$VERBOSE = 0;
- $USE_IPC_RUN = 1;
- $USE_IPC_OPEN3 = 1;
+ $USE_IPC_RUN = $^O ne 'VMS';
+ $USE_IPC_OPEN3 = $^O ne 'VMS';
@ISA = qw[Exporter];
@EXPORT_OK = qw[can_run run];
@@ -32,11 +32,19 @@
sub can_run {
my $command = shift;
+ # a lot of VMS executables have a symbol defined
+ # check those first
+ if ( $^O eq 'VMS' ) {
+ require VMS::DCLsym;
+ my $syms = VMS::DCLsym->new;
+ return $command if scalar $syms->getsym( uc $command );
+ }
+
if( File::Spec->file_name_is_absolute($command) ) {
return MM->maybe_command($command);
} else {
- for my $dir (split /$Config{path_sep}/, $ENV{PATH}) {
+ for my $dir (split /\Q$Config{path_sep}\E/, $ENV{PATH}) {
my $abs = File::Spec->catfile($dir, $command);
return $abs if $abs = MM->maybe_command($abs);
}
--- Cmd.pm.orig Fri Jan 21 21:55:01 2005
+++ Cmd.pm Fri Jan 21 22:14:39 2005
@@ -21,8 +21,8 @@
$VERSION = '0.24';
$VERBOSE = 0;
- $USE_IPC_RUN = 1;
- $USE_IPC_OPEN3 = 1;
+ $USE_IPC_RUN = $^O ne 'VMS';
+ $USE_IPC_OPEN3 = $^O ne 'VMS';
@ISA = qw[Exporter];
@EXPORT_OK = qw[can_run run];
@@ -32,11 +32,19 @@
sub can_run {
my $command = shift;
+ # a lot of VMS executables have a symbol defined
+ # check those first
+ if ( $^O eq 'VMS' ) {
+ require VMS::DCLsym;
+ my $syms = VMS::DCLsym->new;
+ return $command if scalar $syms->getsym( uc $command );
+ }
+
if( File::Spec->file_name_is_absolute($command) ) {
return MM->maybe_command($command);
} else {
- for my $dir (split /$Config{path_sep}/, $ENV{PATH}) {
+ for my $dir (split /\Q$Config{path_sep}\E/, $ENV{PATH}) {
my $abs = File::Spec->catfile($dir, $command);
return $abs if $abs = MM->maybe_command($abs);
}