#!/usr/bin/perl -w use Test::More tests => 26; BEGIN { if ($] >= 5.006){ require Fcntl; Fcntl->import(qw/SEEK_END/); } else { require POSIX; POSIX->import(qw/SEEK_END/); } } BEGIN { use_ok("MPEG::Audio::Frame") } { isa_ok(my $frame = MPEG::Audio::Frame->read(*DATA), "MPEG::Audio::Frame"); ok($frame->bitrate, "bitrate"); ok($frame->sample, "sample rate"); is(length("$frame"), $frame->length, "actual length"); } { isa_ok(my $frame = MPEG::Audio::Frame->read(*DATA), "MPEG::Audio::Frame"); ok($frame->bitrate, "bitrate"); ok($frame->sample, "sample rate"); is(length("$frame"), $frame->length, "actual length"); } is(MPEG::Audio::Frame->read(*DATA), undef, "no more data on FH"); my $n = 15; for (0 .. $n){ seek DATA, -$_, SEEK_END; is(MPEG::Audio::Frame->read(*DATA), undef, "nothing $_ bytes before EOF"); } __DATA__ this is lots of junk, and a few frames in the middle. We're supposed to get only the frames, and nothing else. )3M牫T%{olMQ"yop7X7q{xa-A?&fYQ6@o($:Po6JCZ/(Þ MG0C$AB8hA2$)31a,/˕Đvr`H "(B!`б4d#p< ,.b0nEJ! !0`Y)ЬD@} B( lx:p1R1 $ Qy|t\b~"6& dgskjhag ?H&N ?H?He"=? jK??c:#f;+\ ?o>? 5gbqO P(%1s?????&.A"69O?'l??????y+?a*r.W"?S"PhO?f?P?r.nE|?n\.x Si* o G@0< N?o|? Y?8 L\?1da8???,?"9 ???,"c0A ??@? ??x? ??6Ar ????7 ?P??_7?p?0?0? ?D?=1sA%Yh???R??O??A0=A?E$???afbI%EM$??ffkRUUz?U?j[?etMC#=3?LsBphq??\`YF ?0???sh>!h?BYt?4b ?`Y?(nQ?&< dgkuwj more ʬĩϫgaI(Q-kD1E2 Ht_Dh:iDШ]iDIi x[ƨ̊QYlԐ,}_QuNE(_%FpaRy7/ Tp务YI(F6vaᒧdb.YtS <%S y7K!lx0T }hgfy)4٩