Annotation of wpscripts/ezreturn/ezreturn.pl, Revision 1.1.1.1
1.1 yason 1: #!/usr/bin/perl
2: use strict;
3: use dbops;
4: use fs;
5:
6: # We will use array of files, each described as follows:
7: # $ID[$file] -- ID in database
8: # $file_type[$file] -- string constant that describes type of file (e.g "epdz")
9: # $file_name[$file] -- file name (e.g 66666.eps)
10: # $file_retpath[$file] -- return path without leading slash (e.g /WIDEPRINT/Заявки/Медвед)
11: our $ID_ref;
12: our $file_type_ref;
13: our $file_name_ref;
14: our $file_retpath_ref;
15:
16: # will deref ID_ref to know how many files we've got
17: our @ID;
18:
19: dbops::connect() or die("dbops::connect()");
20: dbops::select() or die("dbops::select()");
21:
22: ($ID_ref, $file_type_ref, $file_name_ref, $file_retpath_ref) = dbops::getall();
23:
24: # temporary
25: @ID = @$ID_ref;
26:
27: if (scalar(@$file_name_ref) == 0) {
28:
29: print "[main] nothing to do\n";
30:
31: dbops::disconnect();
32: exit(-1);
33: }
34:
35: # got something
36: print "[main] got " . scalar(@ID) . " ab_want files from all tables\n";
37:
38: fs::copy($ID_ref, $file_type_ref, $file_name_ref, $file_retpath_ref);
39:
40: dbops::disconnect();
41:
42: exit(0);
43:
CVSweb