/[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.1 by joko, Sun Jan 19 02:08:08 2003 UTC revision 1.3 by root, Wed Jan 22 17:58:48 2003 UTC
# Line 2  Line 2 
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  ##  ##
# Line 18  our @ISA = qw( Exporter ); Line 24  our @ISA = qw( Exporter );
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    
# Line 30  use POSIX qw(strftime); Line 37  use POSIX qw(strftime);
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 {
# Line 39  sub today { Line 50  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 {
# Line 54  sub run_cmds { Line 68  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;

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

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