Skip Menu |
 

This queue is for tickets about the Audio-FLAC-Header CPAN distribution.

Report information
The Basics
Id: 96886
Status: new
Priority: 0/
Queue: Audio-FLAC-Header

People
Owner: Nobody in particular
Requestors: nik.ilych [...] yandex.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.4
Fixed in: (no value)



Subject: Illegal division by zero
Download (untitled) / with headers
text/plain 332b
When i running this script: perl -e 'use Audio::Flac::Header; my $f=shift; my $i=Audio::FLAC::Header->new($f); ($g)=grep /genre/i, (keys $i->{tags}); print $i->{tags}{$g}' "$a" I have this error: Illegal division by zero at /usr/lib/perl5/site_perl/5.14/Audio/Flac/Header.pm line 446. I solve this bug for me in attached patch.
Subject: patch.txt
Download patch.txt
text/plain 705b
446d445 < my $totalSeconds = $info->{'TOTALSAMPLES'} / $info->{'SAMPLERATE'}; 448,453c447,457 < if ($totalSeconds == 0) { < warn "totalSeconds is 0 - we couldn't find either TOTALSAMPLES or SAMPLERATE!\n" . < "setting totalSeconds to 1 to avoid divide by zero error!\n"; < < $totalSeconds = 1; < } --- > my $totalSeconds = 0; > if ($info->{'SAMPLERATE'}) { > $totalSeconds = $info->{'TOTALSAMPLES'} / $info->{'SAMPLERATE'}; > } else { $totalSeconds = 1 } > > # if ($totalSeconds == 0) { > # warn "totalSeconds is 0 - we couldn't find either TOTALSAMPLES or SAMPLERATE!\n" . > # "setting totalSeconds to 1 to avoid divide by zero error!\n"; > # > # $totalSeconds = 1; > # }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.