3 ###############################################################################
6 # Author : Chris Koeritz #
7 # Rights : Copyright (C) 1996-$now by Author #
11 # Operates on a number stored in a text file. the number can be retrieved #
12 # for whatever purpose or it can be incremented. #
14 ###############################################################################
15 # This program is free software; you can redistribute it and/or modify it #
16 # under the terms of the GNU General Public License as published by the Free #
17 # Software Foundation; either version 2 of the License or (at your option) #
18 # any later version. See: "http://www.gruntose.com/Info/GNU/GPL.html" for a #
19 # version of the License. Please send any updates to "fred@gruntose.com". #
20 ###############################################################################
22 # A number is retrieved from the passed in filename and returned.
24 local($number_file) = @_;
25 #print "num file is $number_file\n";
26 open(NUMBERING, "$number_file");
27 local($number) = int(<NUMBERING>);
28 if ($number <= 0) { $number = 1; }
29 if ($number < 10) { $number = '0'.$number; }
30 if ($number < 100) { $number = '0'.$number; }
31 if ($number < 1000) { $number = '0'.$number; }
36 # the number in the passed filename is increased.
38 local($number_file) = @_;
39 local($number) = &get_number($number_file);
40 if ($number < 0) { $number = '0000'; }
42 if ($number > 9999) { $number = '0000'; }
43 open(NUMBERING, "> $number_file");
44 #print "number is now $number\n";
45 print NUMBERING "$number\n";
49 # stores the number specified into the file specified.
51 local($number, $number_file) = @_;
52 #print "storing $number into $number_file\n";
53 open(NUMBERING, "> $number_file");
54 print NUMBERING "$number\n";