]> scm.dxcluster.org Git - spider.git/blob - perl/import_users.pl
done more work on directory now really quite ak1a compatible
[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 $userfn = $ARGV[0] if @ARGV;
26 croak "need a filename" unless $userfn;
27 croak "$userfn.asc doesn't exist" unless -e "$userfn.asc";
28
29 DXUser->init($userfn, 1);
30
31 do "$userfn.asc";
32 print $@ if $@;
33
34 DXUser->finish();