/[cvs]/nfo/perl/libs/Data/Mungle/Compare/Struct.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Mungle/Compare/Struct.pm

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

revision 1.3 by joko, Fri Dec 13 21:47:04 2002 UTC revision 1.7 by joko, Wed Jul 7 03:13:43 2004 UTC
# Line 2  Line 2 
2  ##    $Id$  ##    $Id$
3  ##    --------------------------------------------------------------------------------  ##    --------------------------------------------------------------------------------
4  ##    $Log$  ##    $Log$
5    ##    Revision 1.7  2004/07/07 03:13:43  joko
6    ##    minor fix for "sub isEmpty"
7    ##
8    ##    Revision 1.6  2004/05/12 13:53:19  jonen
9    ##    + bugfix related to declaration of arrays,
10    ##        solved error: 'Bizarre copy of ARRAY in aassign at...'
11    ##
12    ##    Revision 1.5  2003/03/27 15:17:05  joko
13    ##    namespace fixes for Data::Mungle::*
14    ##
15    ##    Revision 1.4  2002/12/19 01:06:27  joko
16    ##    + fixed isEmpty with ARRAYs
17    ##
18  ##    Revision 1.3  2002/12/13 21:47:04  joko  ##    Revision 1.3  2002/12/13 21:47:04  joko
19  ##    + fixes to 'sub isEmpty'  ##    + fixes to 'sub isEmpty'
20  ##  ##
# Line 14  Line 27 
27  ##    --------------------------------------------------------------------------------  ##    --------------------------------------------------------------------------------
28    
29    
30  package Data::Compare::Struct;  package Data::Mungle::Compare::Struct;
31    
32  use strict;  use strict;
33  use warnings;  use warnings;
# Line 35  sub getRelations { Line 48  sub getRelations {
48    my @a = @{$a_ref};    my @a = @{$a_ref};
49    my @b = @{$b_ref};    my @b = @{$b_ref};
50    
51    my @isect = my @diff = my @union = ();    # BUGFIX 2004-05-12: following declaration of arrays occures an strange perl error:
52      # 'Bizarre copy of ARRAY in aassign at ..<PATH_TO>/<THIS_FILE> line <NEXT LINE>'
53      # (at PERL 5.8.4, Debian/unstable/experimental)
54      #
55      #my @isect = my @diff = my @union = ();
56      #
57      # so use normal declaration instead!!
58      my @isect = ();
59      my @diff = ();
60      my @union = ();
61    
62    my $e;    my $e;
63    my %count;    my %count;
64        
# Line 104  sub isEmpty { Line 127  sub isEmpty {
127      my $isReallyEmpty = ($#arr == -1 ? 1 : 0);      my $isReallyEmpty = ($#arr == -1 ? 1 : 0);
128      return 1 if $isReallyEmpty;      return 1 if $isReallyEmpty;
129      $found = 1;      $found = 1;
130      foreach (@$var) {      foreach (@arr) {
131        return 0 if defined $_;        #return 0 if defined $_;
132          #return 1 if isEmpty($_);
133          return 0 if !isEmpty($_);
134      }      }
135    
136    } elsif ($reftype eq 'HASH') {    } elsif ($reftype eq 'HASH') {
# Line 134  sub isEmpty { Line 159  sub isEmpty {
159      return $empty;      return $empty;
160      #return 0;      #return 0;
161        
162    } else {    # check for empty string
163      } elsif (defined $var) {
164      $found = 1;      $found = 1;
165      return 0 if defined $var;      return 0 if $var ne '';
166    }    }
167        
168    if (!$found) {    if (!$found) {
169      print "isEmpty could not parse variable ( ref $ref reftype $reftype )", "\n";      print "isEmpty could not parse variable ( ref $ref reftype $reftype )", "\n";
170    }    }
171    
172      #print "EMPTY!!!", "\n";
173    
174    return 1;    return 1;
175        
176  }  }

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

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