I seem to have stumbled across a bug in Perl 5.8.4, and I'm wondering if anyone else can help me confirm it's a bug.

Basically I have a piece of software here containing a module Browser.pm. It's been running fine for me on FreeBSD with perl 5.8.5 (and also on some earlier versions of perl), and I have users running it ok on Mandrake and Windows. However, I find that on perl 5.8.4 on Debian-Sarge, if I do "perl -c Browser.pm", perl goes into an endless loop, eating CPU like crazy. I'd appreciate it greatly if anyone could supply more data points, by downloading the tarball and running a perl -c on it on their own system. At this point I'm not sure if (a) it's a bug in perl 5.8.4 that was fixed in 5.8.5, (b) it's a bug in the version of perl being distributed with Debian-sarge, or (c) there's something else going on that I don't understand. If it's a, then I guess I just post a notice on my web page saying my software is known not to work with 5.8.4. If it's b, then maybe I should report it as a bug to Debian. If it's c, then maybe it's a bug in perl that I should report, or...?

TIA!

Thanks, all, for your help! The suggestion about the BEGIN block was bang on -- I'd been assuming that Perl would just be checking the syntax, didn't realize it was doign the BEGIN blocks. The following turns out to be a somewhat more minimal example:

eval "use Audio::Data"; my ($server,$sound); eval { # Don't crash and burn if they don't have Audio installed. my $silent = Audio::Data->new(rate=>44100.); my $shk = Audio::Data->new(rate=>44100.); my $delay = 0.06; # so it doesn't occur at the same instant as the + sound of the clicking key my $duration = 0.05; $silent->silence($delay); $shk->noise($duration,1.6); my $n = $shk->samples; my $attack_frac = .1; for (my $i=0; $i<=$n; $i++) { my $attack = 1.; if ($i<$n*$attack_frac) {$attack=$i/($n*$attack_frac)} my $tail = ($n-$i)/$n; my $env = $attack*$attack*$tail*$tail*$tail; $shk->[$i] *= $env; } $sound = Audio::Data->new(rate=>44100.); $sound = $silent . $shk; };
Interestingly, it seems to be very hard to take any code out of this without curing the bug. So the long and the short of it seems to be that it's a bug in Audio::Data.

In reply to bug in perl 5.8.4? by bcrowell2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.