Revision: | 1.1 |
Committed: | Mon Sep 20 16:29:46 1999 UTC (25 years, 7 months ago) by williamc |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | v102p1, V1_0_1, V1_0_0, V1_pre0, SCRAM_V1, SCRAMV1_IMPORT, V0_19_7, V0_19_6, V0_19_6p1, V0_19_5, SFATEST, V0_19_4, V0_19_4_pre3, V0_19_4_pre2, V0_19_4_pre1, V0_19_3, V0_19_2, V0_19_1, V0_19_0, V0_18_5, V0_18_4, V_18_3_TEST, VO_18_3, V0_18_2, V0_18_1, ProtoEnd |
Branch point for: | V1_pre1, SCRAM_V1_BRANCH, V0_19_4_B |
Log Message: | BAsic Working SearchPath |
# | Content |
---|---|
1 | # |
2 | # PathMod.pm |
3 | # |
4 | # Originally Written by Christopher Williams |
5 | # |
6 | # Description |
7 | # |
8 | # Interface |
9 | # --------- |
10 | # new() : A new PathMod object |
11 | # Searchpath(path, filename) : return the first occurance of filename in the |
12 | # path |
13 | |
14 | package Utilities::PathMod; |
15 | require 5.001; |
16 | |
17 | sub new { |
18 | my $class=shift; |
19 | $self={}; |
20 | bless $self, $class; |
21 | return $self; |
22 | } |
23 | |
24 | sub SearchPath { |
25 | my $self=shift; |
26 | my $path=shift; |
27 | my $filename=shift; |
28 | |
29 | my @dirs; |
30 | my $dir; |
31 | my $file=""; |
32 | |
33 | @dirs=split /:/, $path; |
34 | foreach $dir ( @dirs ) { |
35 | if ( -e $dir."/".$filename ) { |
36 | $file=$dir."/".$filename; |
37 | last; |
38 | } |
39 | } |
40 | return $file; |
41 | } |