[ic] Changed UTIL.pm and Got subcatalogs working under 4.9.8

Shawn Mathews eyefivesupport at aol.com
Sun Jul 20 14:35:07 EDT 2003


OK, I took a big step for myself and changed UTIL.pm and it worked.

I'm not sure if this is something I should have done or if this will 
always work.

sub copyref {
     my($x,$r) = @_;

     my($z, $y);

     my $rt = ref $x;

     if ($rt =~ /(SCALAR|Regexp)/i) {    # Use to be $rt =~ /SCALAR/
         # Would \$$x work?
         $z = $$x;
         return \$z;
     } elsif ($rt =~ /HASH/) {
         $r = {} unless defined $r;
         for $y (sort keys %$x) {
             $r->{$y} = &copyref($x->{$y}, $r->{$y});
         }
         return $r;
     } elsif ($rt =~ /ARRAY/) {
         $r = [] unless defined $r;
         for ($y = 0; $y <= $#{$x}; $y++) {
             $r->[$y] = &copyref($x->[$y]);
         }
         return $r;
     } elsif ($rt =~ /REF/) {
         $z = &copyref($x);
         return \$z;
     } elsif (! $rt) {
         return $x;
     } else {
         die "do not know how to copy $x";
     }
}

------
Shawn Mathews
eyefivesupport at aol.com



More information about the interchange-users mailing list