| 1 | package Image::TextMode::Reader::Bin; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 2 | extends 'Image::TextMode::Reader'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | sub _read { | ||||||||||||||||||||||||||||
| 8 | 2 | ▶ | my ( $self, $image, $fh, $options ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_read: called CC=7 SCAR=21.4
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | if ( $image->has_sauce ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 11 | 0 | $image->render_options->{ blink_mode } = ($image->sauce->flags_id & 1) ^ 1; | |||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | my $width = $options->{ width } || 160; | ||||||||||||||||||||||||||
|
Condition50%1/2
$options->{'width'} || 160
MC/DC0%0/1
$options->{'width'} || 160
$options->{'width'}
Truth table50%1/2
A
A= $options->{'width'}
| |||||||||||||||||||||||||||||
| 15 | 2 | my ( $x, $y ) = ( 0, 0 ); | |||||||||||||||||||||||||||
| 16 | 2 | my $eof = chr( 26 ); | |||||||||||||||||||||||||||
| 17 | 2 | my $chardata; | |||||||||||||||||||||||||||
| 18 | 2 | ▶ | while ( read( $fh, $chardata, 2 ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | 8 | my @data = unpack( 'aC', $chardata ); | |||||||||||||||||||||||||||
| 20 | 8 | ▶ | last if tell( $fh ) > $options->{ filesize } || $data[ 0 ] eq $eof; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
tell $fh > $options->{"filesize"} or $data[0] eq $eof
MC/DC0%0/2
tell $fh > $options->{"filesize"} or $data[0] eq $eof
tell $fh > $options->{"filesize"}
$data[0] eq $eof
Truth table33%1/3
A or B
A= tell $fh > $options->{"filesize"}B= $data[0] eq $eof
| |||||||||||||||||||||||||||||
| 21 | 8 | $image->putpixel( { char => $data[ 0 ], attr => $data[ 1 ] }, $x, | |||||||||||||||||||||||||||
| 22 | $y ); | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 8 | $x++; | |||||||||||||||||||||||||||
| 25 | 8 | ▶ | if ( $x == $width ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 0 | $x = 0; | |||||||||||||||||||||||||||
| 27 | 0 | $y++; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 2 | return $image; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head1 NAME | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | Image::TextMode::Reader::Bin - Reads Bin files | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | Provides reading capabilities for the Bin format. | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | Brian Cassidy E<lt>bricas@cpan.orgE<gt> | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | Copyright 2008-2015 by Brian Cassidy | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 51 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =cut | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 2 | 1; | |||||||||||||||||||||||||||