Rafaël Garcia-Suarez > perl-5.9.5 > lib/SelfLoader-buggy.t

Download:
perl-5.9.5.tar.gz

Annotate this POD

Source  

RT 40216 ^

  by Bo Lindbergh <blgl@hagernas.com>, at Aug 22, 2006 5:42 PM

In the example below, there's a syntax error in the selfloaded code for main::buggy. When the eval fails, SelfLoader::AUTOLOAD tries to report this with "croak $@;". Unfortunately, SelfLoader::croak does "require Carp;" without protecting $@, which gets clobbered. The program then dies with the uninformative message " at ./example line 3".

#! /usr/local/bin/perl use SelfLoader; buggy(); __END__ sub buggy { +>*; }

syntax highlighting: