2 ## AIX Example provided by Russel Adams
3 ## ..... lspv -p hdisk0
4 ## Column headers explicitly provided
9 use Test
::More tests
=> 13;
11 use DataExtract
::FixedWidth
;
13 my $file = File
::Spec
->catfile( 't', 'data', 'RusselAdams-Snap.txt' );
14 open ( my $fh, $file ) || die "Can not open $file";
17 while ( my $line = <$fh> ) {
20 $fw = DataExtract
::FixedWidth
->new({
29 ok
( $fw->unpack_string eq 'a10a8a14a20a11A*'
30 , 'Testing hard coded prerendered unpack string'
31 . ' Expected a10a8a14a20a11A'
32 . ' got ' . $fw->unpack_string
36 my $arrRef = $fw->parse( $line );
37 my $hashRef = $fw->parse_hash( $line );
41 ok
( $hashRef->{'PP RANGE'} eq '1-1', "Testing output (->parse_hash)" );
42 ok
( $hashRef->{'REGION'} eq 'outer edge', "Testing output (->parse_hash)" );
43 ok
( $hashRef->{'MOUNT POINT'} eq 'N/A', "Testing output (->parse_hash)" );
45 ok
( $arrRef->[0] eq '1-1', "Testing output (->parse)" );
46 ok
( $arrRef->[2] eq 'outer edge', "Testing output (->parse)" );
47 ok
( $arrRef->[5] eq 'N/A', "Testing output (->parse)" );
50 ok
( $hashRef->{'PP RANGE'} eq '205-217', "Testing output (->parse_hash)" );
51 ok
( $hashRef->{'REGION'} eq 'outer middle', "Testing output (->parse_hash)" );
52 ok
( $hashRef->{'MOUNT POINT'} eq '', "Testing output (->parse_hash)" );
54 ok
( $arrRef->[0] eq '205-217', "Testing output (->parse)" );
55 ok
( $arrRef->[2] eq 'outer middle', "Testing output (->parse)" );
56 ok
( $arrRef->[5] eq '', "Testing output (->parse)" );