Revision: | 1.5 |
Committed: | Fri Dec 14 09:04:17 2007 UTC (17 years, 5 months ago) by muzaffar |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | V1_1_7, V1_1_6, V1_1_5, V1_2_0-cand3, V1_2_0-cand2, V1_2_0-cand1, V1_1_4, V1_1_3, V1_1_2, V1_1_0_reltag8, V1_1_0_reltag7, V1_1_0_reltag6, V1_1_1, V1_1_0_reltag5, V1_1_0_reltag4, V1_1_0_reltag3, V1_1_0_reltag2, V1_1_0_reltag1, V1_1_0_reltag, V1_1_0, V1_1_0_cand3, V1_1_0_cand2, V1_1_0_cand1 |
Branch point for: | forBinLess_SCRAM |
Changes since 1.4: | +0 -0 lines |
Log Message: | replace head with xml branch |
# | User | Rev | Content |
---|---|---|---|
1 | sashby | 1.2 | BEGIN |
2 | { | ||
3 | sashby | 1.3 | die "Utilities::PathMod: I AM used...","\n"; |
4 | sashby | 1.2 | }; |
5 | |||
6 | williamc | 1.1 | # |
7 | # PathMod.pm | ||
8 | # | ||
9 | # Originally Written by Christopher Williams | ||
10 | # | ||
11 | # Description | ||
12 | # | ||
13 | # Interface | ||
14 | # --------- | ||
15 | # new() : A new PathMod object | ||
16 | # Searchpath(path, filename) : return the first occurance of filename in the | ||
17 | # path | ||
18 | |||
19 | package Utilities::PathMod; | ||
20 | require 5.001; | ||
21 | |||
22 | sub new { | ||
23 | my $class=shift; | ||
24 | $self={}; | ||
25 | bless $self, $class; | ||
26 | return $self; | ||
27 | } | ||
28 | |||
29 | sub SearchPath { | ||
30 | my $self=shift; | ||
31 | my $path=shift; | ||
32 | my $filename=shift; | ||
33 | |||
34 | my @dirs; | ||
35 | my $dir; | ||
36 | my $file=""; | ||
37 | |||
38 | @dirs=split /:/, $path; | ||
39 | foreach $dir ( @dirs ) { | ||
40 | if ( -e $dir."/".$filename ) { | ||
41 | $file=$dir."/".$filename; | ||
42 | last; | ||
43 | } | ||
44 | } | ||
45 | return $file; | ||
46 | } |