----- Original Message ----- 
From: "Chris Wagner"

> Cygwin checks for a shebang line as well as the
> extension and contents to see if a file should be considered executable.
I
> guess that would overlook a zero byte file as well.  Oh well.  It might be
> worth it to look into the find command to emulate the search that perl -S
does.
>

How about something like (tested ... but maybe I've overlooked something):

use warnings;

my $filename = 'ppm';

which_file_in_path($filename);

sub which_file_in_path {
    my @paths = split /;/, $ENV{PATH};
    for (@paths) {
        if(open(RD, $_ . "/" . $_[0])) {
          close(RD) or die "Can't close RD: $!";
          print $_, "\\", $_[0], "\n";
          last;
          }
        }
}

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to