--- nfo/perl/libs/org/netfrag/shortcuts.pm 2003/01/19 02:08:08 1.1 +++ nfo/perl/libs/org/netfrag/shortcuts.pm 2003/01/22 17:58:48 1.3 @@ -1,7 +1,13 @@ ## --------------------------------------------------------------------------- -## $Id: shortcuts.pm,v 1.1 2003/01/19 02:08:08 joko Exp $ +## $Id: shortcuts.pm,v 1.3 2003/01/22 17:58:48 root Exp $ ## --------------------------------------------------------------------------- ## $Log: shortcuts.pm,v $ +## Revision 1.3 2003/01/22 17:58:48 root +## sub get_chomped +## +## Revision 1.2 2003/01/20 21:19:27 joko +## + updated 'sub now': knows about option 'fs' now +## ## Revision 1.1 2003/01/19 02:08:08 joko ## + initial check-in ## @@ -18,6 +24,7 @@ our @EXPORT_OK = qw( now today run_cmd run_cmds + get_chomped ); @@ -30,7 +37,11 @@ # see "perldoc -f localtime" sub now { - return strftime("%Y-%m-%d %H:%M:%S", localtime); + my $options = shift; + my $pattern = "%Y-%m-%d %H:%M:%S"; + $pattern = "%Y-%m-%d_%H-%M-%S" if $options->{fs}; + my $result = strftime($pattern, localtime); + return $result; } sub today { @@ -39,13 +50,16 @@ sub run_cmd { my $cmd = shift; - $cmd = 'perl ' . $cmd; + my $caption = shift; + #$cmd = 'perl ' . $cmd; my $sep = "-" x 90; print $sep, "\n"; print " ", $cmd, "\n"; + print " ", $caption, "\n" if $caption; print $sep, "\n"; system($cmd); - print "\n"; + #`$cmd`; + print "ready.", "\n"; } sub run_cmds { @@ -54,5 +68,10 @@ } } +sub get_chomped { + my $str = shift; + chomp($str); + return $str; +} 1;