Changeset 30885
- Timestamp:
- Mar 13, 2011, 5:00:00 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psconfig
- Files:
-
- 3 added
- 1 edited
-
pscheckmods (modified) (2 diffs)
-
tagsets/ipp-3.0.dist (added)
-
tagsets/ipp-3.0.libs (added)
-
tagsets/ipp-3.0.perl (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psconfig/pscheckmods
r28191 r30885 1 1 #!/usr/bin/env perl 2 2 3 $VERBOSE = 0; 4 if (@ARGV > 2 && $ARGV[0] eq "-v") { 5 $VERBOSE = 1; 6 shift @ARGV; 7 } 3 8 if (@ARGV != 2) { die "USAGE: pscheckmods (module) (version)\n"; } 4 9 5 # print STDERR "checking in @INC\n"; 10 if ($VERBOSE) { print STDERR "checking in @INC\n"; } 11 12 # &detailed_require ($ARGV[0]); 6 13 7 14 $x = eval "require $ARGV[0]; 1"; 8 15 if (! $x) { 9 # print "$ARGV[0]: missing\n"; 10 exit 1; 16 if (! $VERBOSE) { exit 1; } 17 print "$ARGV[0]: missing\n"; 18 &detailed_require ($ARGV[0]); 11 19 } 12 # print "x: $x\n"; 20 if ($VERBOSE) { print "x: $x\n"; } 13 21 14 22 $version = eval "\$$ARGV[0]::VERSION"; … … 21 29 22 30 exit 0; 31 32 sub detailed_require { 33 my ($filename) = @_; 34 $filename =~ s|::|/|g; 35 $filename = "$filename.pm"; 36 print "$filename\n"; 37 if (exists $INC{$filename}) { 38 return 1 if $INC{$filename}; 39 die "Compilation failed in require"; 40 } 41 my ($realfilename,$result); 42 ITER: { 43 foreach $prefix (@INC) { 44 $realfilename = "$prefix/$filename"; 45 print "$realfilename\n"; 46 if (-f $realfilename) { 47 $INC{$filename} = $realfilename; 48 $result = do $realfilename; 49 last ITER; 50 } 51 } 52 die "Can't find $filename in \@INC"; 53 } 54 if ($@) { 55 $INC{$filename} = undef; 56 die $@; 57 } elsif (!$result) { 58 delete $INC{$filename}; 59 die "$filename did not return true value"; 60 } else { 61 return $result; 62 } 63 }
Note:
See TracChangeset
for help on using the changeset viewer.
