| 2 |
## $Id$ |
## $Id$ |
| 3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
| 4 |
## $Log$ |
## $Log$ |
| 5 |
|
## Revision 1.4 2003/02/09 16:31:00 joko |
| 6 |
|
## - moved code to ../../shortcuts.pm, this just inherits from that module now |
| 7 |
|
## |
| 8 |
|
## Revision 1.3 2003/01/22 17:58:48 root |
| 9 |
|
## sub get_chomped |
| 10 |
|
## |
| 11 |
|
## Revision 1.2 2003/01/20 21:19:27 joko |
| 12 |
|
## + updated 'sub now': knows about option 'fs' now |
| 13 |
|
## |
| 14 |
## Revision 1.1 2003/01/19 02:08:08 joko |
## Revision 1.1 2003/01/19 02:08:08 joko |
| 15 |
## + initial check-in |
## + initial check-in |
| 16 |
## |
## |
| 23 |
use warnings; |
use warnings; |
| 24 |
|
|
| 25 |
require Exporter; |
require Exporter; |
| 26 |
our @ISA = qw( Exporter ); |
our @ISA = qw( shortcuts Exporter ); |
| 27 |
our @EXPORT_OK = qw( |
our @EXPORT_OK = qw( |
| 28 |
now today |
now today |
| 29 |
run_cmd run_cmds |
run_cmd run_cmds |
| 30 |
|
get_chomped |
| 31 |
); |
); |
| 32 |
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - main |
|
|
|
|
|
use Data::Dumper; |
|
|
use POSIX qw(strftime); |
|
|
|
|
|
# $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime; |
|
|
# see "perldoc -f localtime" |
|
|
|
|
|
sub now { |
|
|
return strftime("%Y-%m-%d %H:%M:%S", localtime); |
|
|
} |
|
|
|
|
|
sub today { |
|
|
return strftime("%Y-%m-%d", localtime); |
|
|
} |
|
|
|
|
|
sub run_cmd { |
|
|
my $cmd = shift; |
|
|
$cmd = 'perl ' . $cmd; |
|
|
my $sep = "-" x 90; |
|
|
print $sep, "\n"; |
|
|
print " ", $cmd, "\n"; |
|
|
print $sep, "\n"; |
|
|
system($cmd); |
|
|
print "\n"; |
|
|
} |
|
|
|
|
|
sub run_cmds { |
|
|
foreach (@_) { |
|
|
run_cmd($_); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
| 33 |
1; |
1; |