/[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.4 by cvsjoko, Fri Aug 16 19:06:39 2002 UTC revision 1.6 by joko, Sun Nov 17 07:18:59 2002 UTC
# Line 3  Line 3 
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.6  2002/11/17 07:18:59  joko
7    #  + sub deep_copy
8    #
9    #  Revision 1.5  2002/10/27 18:34:28  joko
10    #  + sub now
11    #
12  #  Revision 1.4  2002/08/16 19:06:39  cvsjoko  #  Revision 1.4  2002/08/16 19:06:39  cvsjoko
13  #  + sub getDirList  #  + sub getDirList
14  #  #
# Line 31  require Exporter; Line 37  require Exporter;
37      croak      croak
38      array_getDifference      array_getDifference
39      getDirList      getDirList
40        now
41        deep_copy
42  );  );
43    
44  use strict;  use strict;
# Line 204  sub getDirList { Line 212  sub getDirList {
212  # =============================================  # =============================================
213    
214    
215    sub now {
216      return strftime("%Y-%m-%d %H:%M:%S", localtime);
217    }
218    
219    sub deep_copy {
220      my $this = shift;
221      if (not ref $this) {
222        $this;
223      } elsif (ref $this eq "ARRAY") {
224        [map deep_copy($_), @$this];
225      } elsif (ref $this eq "HASH") {
226        +{map { $_ => deep_copy($this->{$_}) } keys %$this};
227      } elsif (ref $this eq "CODE") {
228        $this;
229      } else { die "what type is $_?" }
230    }
231    
232  1;  1;

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

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