2 |
## $Id$ |
## $Id$ |
3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.3 2003/01/22 17:58:48 root |
6 |
|
## sub get_chomped |
7 |
|
## |
8 |
|
## Revision 1.2 2003/01/20 21:19:27 joko |
9 |
|
## + updated 'sub now': knows about option 'fs' now |
10 |
|
## |
11 |
## Revision 1.1 2003/01/19 02:08:08 joko |
## Revision 1.1 2003/01/19 02:08:08 joko |
12 |
## + initial check-in |
## + initial check-in |
13 |
## |
## |
24 |
our @EXPORT_OK = qw( |
our @EXPORT_OK = qw( |
25 |
now today |
now today |
26 |
run_cmd run_cmds |
run_cmd run_cmds |
27 |
|
get_chomped |
28 |
); |
); |
29 |
|
|
30 |
|
|
37 |
# see "perldoc -f localtime" |
# see "perldoc -f localtime" |
38 |
|
|
39 |
sub now { |
sub now { |
40 |
return strftime("%Y-%m-%d %H:%M:%S", localtime); |
my $options = shift; |
41 |
|
my $pattern = "%Y-%m-%d %H:%M:%S"; |
42 |
|
$pattern = "%Y-%m-%d_%H-%M-%S" if $options->{fs}; |
43 |
|
my $result = strftime($pattern, localtime); |
44 |
|
return $result; |
45 |
} |
} |
46 |
|
|
47 |
sub today { |
sub today { |
50 |
|
|
51 |
sub run_cmd { |
sub run_cmd { |
52 |
my $cmd = shift; |
my $cmd = shift; |
53 |
$cmd = 'perl ' . $cmd; |
my $caption = shift; |
54 |
|
#$cmd = 'perl ' . $cmd; |
55 |
my $sep = "-" x 90; |
my $sep = "-" x 90; |
56 |
print $sep, "\n"; |
print $sep, "\n"; |
57 |
print " ", $cmd, "\n"; |
print " ", $cmd, "\n"; |
58 |
|
print " ", $caption, "\n" if $caption; |
59 |
print $sep, "\n"; |
print $sep, "\n"; |
60 |
system($cmd); |
system($cmd); |
61 |
print "\n"; |
#`$cmd`; |
62 |
|
print "ready.", "\n"; |
63 |
} |
} |
64 |
|
|
65 |
sub run_cmds { |
sub run_cmds { |
68 |
} |
} |
69 |
} |
} |
70 |
|
|
71 |
|
sub get_chomped { |
72 |
|
my $str = shift; |
73 |
|
chomp($str); |
74 |
|
return $str; |
75 |
|
} |
76 |
|
|
77 |
1; |
1; |