/[cvs]/nfo/perl/libs/org/netfrag/shortcuts.pm
ViewVC logotype

Diff of /nfo/perl/libs/org/netfrag/shortcuts.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by root, Wed Jan 22 17:58:48 2003 UTC revision 1.4 by joko, Sun Feb 9 16:31:00 2003 UTC
# Line 2  Line 2 
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  ##  Revision 1.3  2003/01/22 17:58:48  root
9  ##  sub get_chomped  ##  sub get_chomped
10  ##  ##
# Line 20  use strict; Line 23  use strict;
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    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 {  
   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;  
 }  
   
33  1;  1;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed