--- nfo/perl/libs/org/netfrag/shortcuts.pm 2003/01/22 17:58:48 1.3 +++ nfo/perl/libs/org/netfrag/shortcuts.pm 2003/02/09 16:31:00 1.4 @@ -1,7 +1,10 @@ ## --------------------------------------------------------------------------- -## $Id: shortcuts.pm,v 1.3 2003/01/22 17:58:48 root Exp $ +## $Id: shortcuts.pm,v 1.4 2003/02/09 16:31:00 joko Exp $ ## --------------------------------------------------------------------------- ## $Log: shortcuts.pm,v $ +## Revision 1.4 2003/02/09 16:31:00 joko +## - moved code to ../../shortcuts.pm, this just inherits from that module now +## ## Revision 1.3 2003/01/22 17:58:48 root ## sub get_chomped ## @@ -20,58 +23,11 @@ use warnings; require Exporter; -our @ISA = qw( Exporter ); +our @ISA = qw( shortcuts Exporter ); our @EXPORT_OK = qw( now today run_cmd run_cmds get_chomped ); - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 { - 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 { - return strftime("%Y-%m-%d", localtime); -} - -sub run_cmd { - my $cmd = shift; - 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); - #`$cmd`; - print "ready.", "\n"; -} - -sub run_cmds { - foreach (@_) { - run_cmd($_); - } -} - -sub get_chomped { - my $str = shift; - chomp($str); - return $str; -} - 1;