SWF/Type/String.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 38 CC 2 SCAR 11.0
CC
2
Cov
0%
parse
6.0
build
2.0
string
2.0
CRAP 3.0
1 package IO::SWF::Type::String;
2  
3 use strict;
4 use warnings;
5  
6 use base 'IO::SWF::Type';
7  
8 use IO::SWF::Bit;
9  
10 sub parse {
11 my ($reader, $opts_href) = @_;
12 my $str = '';
13 while ($reader->hasNextData(1)) {
14 my $c = $reader->getData(1);
15 if ($c eq "\0") {
16 last;
17 }
18 $str .= $c;
19 }
20 return $str;
21 }
22  
23 sub build {
24 my ($writer, $str, $opts_ref) = @_;
25 my @strs = split('\0', $str);
26 $str = $strs[0];
27 $writer->putData($str."\0", length($str) + 1);
28 }
29  
30 sub string {
31 my ($str, $opts_href) = @_;
32 return $str;
33 }
34  
35 1;