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

Mike Heins mike at perusion.com
Sun Jul 20 15:04:13 EDT 2003


Quoting Shawn Mathews (eyefivesupport at aol.com):
> OK, I took a big step for myself and changed UTIL.pm and it worked.

Good -- taking big steps is nice. 8-)

> 
> 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";
>      }
> }
> 

That should be OK, but I think the fix that I posted in the other
message might be more appropriate.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike at perusion.com>

The U.S. Senate -- white male millionaires working for YOU!  -- Dave Barry


More information about the interchange-users mailing list