/[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.5 by joko, Sun Oct 27 18:34:28 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  #  Revision 1.5  2002/10/27 18:34:28  joko
10  #  + sub now  #  + sub now
11  #  #
# Line 35  require Exporter; Line 38  require Exporter;
38      array_getDifference      array_getDifference
39      getDirList      getDirList
40      now      now
41        deep_copy
42  );  );
43    
44  use strict;  use strict;
# Line 212  sub now { Line 216  sub now {
216    return strftime("%Y-%m-%d %H:%M:%S", localtime);    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.5  
changed lines
  Added in v.1.6

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