title: Carp: Bizarre copy of ARRAY in sassign. Any fixes?
body: <p>I'm suffering an annoying problem when trying to <code>die</code> from within an <code>eval</code>.</p>
  
  <p>The code is as follows;</p>
  
  <pre><code>$status = eval { $self-&gt;$func( @{$y-&gt;{args}} ); };
  </code></pre>
  
  <p>in this case <code>$self-&gt;$func</code> points to a handler that detaches to a certain page on error like this:</p>
  
  <pre><code>sub detach
  {
      my $self   = shift;
      my $url    = shift;
      my @params = @_;
  
      if( $url !~ /^\// )
      {
          $url = '/' . $self-&gt;namespace . '/' . $url;
      }
      $url =~ s/\sat.*$//;
      print STDERR $self-&gt;uri . ": Detaching to " . $url . "\n";
  
      die "REDIR:$url";
  }
  </code></pre>
  
  <p>this <em>should</em> place <code>"REDIR:$url"</code> into <code>$@</code> so it's available when the <code>eval</code> exits.</p>
  
  <p>However, instead Carp.pm dies, I assume somewhere in the internals of <code>die</code> with </p>
  
  <blockquote>
  <pre><code>Bizarre copy of ARRAY in sassign at /usr/share/perl/5.10/Carp.pm line 182
  </code></pre>
  </blockquote>
  
  <p>Looking around there is some suggestion that there is a bug deep in perl relating to the stack during die (e.g. <a href="http://code.activestate.com/lists/perl5-porters/149248/" rel="nofollow">http://code.activestate.com/lists/perl5-porters/149248/</a>), however I'm afraid that at this point I'm at the limit of my knowledge of perl and I'm not sure if this is relevant, or what to do about it if it is. <code>:(</code></p>
  
  <p>Does anyone know if there is a way around this problem or another way to pass an error string back from the <code>eval</code>, or if I'm reading this incorrectly? </p>