11. made import_users.pl accept a non related input filename and always
[spider.git] / perl / import_users.pl
1 #!/usr/bin/perl
2 #
3 # Export the user file in a form that can be directly imported
4 # back with a do statement
5 #
6
7 require 5.004;
8
9 # search local then perl directories
10 BEGIN {
11         umask 002;
12         
13         # root of directory tree for this system
14         $root = "/spider"; 
15         $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
16         
17         unshift @INC, "$root/perl";     # this IS the right way round!
18         unshift @INC, "$root/local";
19 }
20
21 use DXVars;
22 use DXUser;
23 use Carp;
24
25 $inpfn = $ARGV[0] if @ARGV;
26 croak "need a input filename" unless $inpfn;
27
28 DXUser->init($userfn, 1);
29
30 do "$inpfn";
31 print $@ if $@;
32
33 DXUser->finish();