/[cvs]/nfo/perl/libs/libp.pm
ViewVC logotype

Diff of /nfo/perl/libs/libp.pm

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

revision 1.7 by joko, Fri Nov 29 04:44:53 2002 UTC revision 1.10 by joko, Thu Dec 19 01:05:35 2002 UTC
# Line 3  Line 3 
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.10  2002/12/19 01:05:35  joko
7    #  + sub today
8    #
9    #  Revision 1.9  2002/12/05 13:54:00  joko
10    #  + fix: let 'deep_copy' print its message out (instead of die)
11    #
12    #  Revision 1.8  2002/12/01 22:11:35  joko
13    #  + sub cmd
14    #  + sub run_cmds
15    #
16  #  Revision 1.7  2002/11/29 04:44:53  joko  #  Revision 1.7  2002/11/29 04:44:53  joko
17  #  - sub array_getRelations  #  - sub array_getRelations
18  #  + sub getNewPerlObjectByPkgName  #  + sub getNewPerlObjectByPkgName
# Line 47  our @EXPORT_OK = qw( Line 57  our @EXPORT_OK = qw(
57      now      now
58      deep_copy      deep_copy
59      getNewPerlObjectByPkgName      getNewPerlObjectByPkgName
60        cmd
61        run_cmds
62        today
63  );  );
64    
65  use Data::Dumper;  use Data::Dumper;
# Line 193  sub now { Line 206  sub now {
206    return strftime("%Y-%m-%d %H:%M:%S", localtime);    return strftime("%Y-%m-%d %H:%M:%S", localtime);
207  }  }
208    
209    sub today {
210      return strftime("%Y-%m-%d", localtime);
211    }
212    
213  # ACK's go to ...  # ACK's go to ...
214  sub deep_copy {  sub deep_copy {
215    my $this = shift;    my $this = shift;
# Line 204  sub deep_copy { Line 221  sub deep_copy {
221      +{map { $_ => deep_copy($this->{$_}) } keys %$this};      +{map { $_ => deep_copy($this->{$_}) } keys %$this};
222    } elsif (ref $this eq "CODE") {    } elsif (ref $this eq "CODE") {
223      $this;      $this;
224    } else { die "what type is $_?" }    #} else { die "deep_copy asks: what type is $this?" }
225      } else { print "deep_copy asks: what type is $this?", "\n"; }
226  }  }
227    
228  sub getNewPerlObjectByPkgName {  sub getNewPerlObjectByPkgName {
# Line 218  sub getNewPerlObjectByPkgName { Line 236  sub getNewPerlObjectByPkgName {
236    return $pkgname->new($args);    return $pkgname->new($args);
237  }  }
238    
239    sub cmd ($) {
240      my $cmd = shift;
241      $cmd = 'perl ' . $cmd;
242      my $sep = "-" x 90;
243      print $sep, "\n";
244      print "  ", $cmd, "\n";
245      print $sep, "\n";
246      system($cmd);
247      print "\n";
248    }
249    
250    sub run_cmds {
251      foreach (@_) {
252        cmd($_);
253      }
254    }
255    
256  1;  1;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.10

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