sub dump_afp {
my $obj = shift;
my $struct = $obj->struct;
my @keys
= sort grep !
/^_|^(?:Data|EscapeSequence|ControlCode|Length|CC|(?:Sub)?Type|FlagByte)$/,
keys %$struct;
push @keys, 'Data' if exists $struct->{Data};
WID:
foreach my $key (@keys) {
next if ref $struct->{$key};
length( $x = $struct->{$key} ) or next;
if ( $obj->ENCODING
and grep { $key eq $_ } $obj->ENCODED_FIELDS )
{
$x = $obj->$key;
$x = qq("$x");
}
elsif ( $x =~ /[^\w\s]/ ) {
$x = "";
}
if ( $key eq 'Data' ) {
if ( $x =~ m/^\"(\w|\d|\$)/ ) {
$x =~ s/\"|\(|\)//g;
if ( $x =~ m/^\d\d\/\d\d\/\d\d\s/ ) {
my @dateinfo = split( /\s/, $x );
if ( $dateinfo[0] =~ m/^\d\d\/\d\d\/\d\d/ ) {
print "";
print $dateinfo[0];
print "\n";
print "";
print $dateinfo[1];
print "\n";
}
}
else {
if ( $x =~ m/^\d\d\/\d\d\/\d\d/ ) {
print "";
print $x;
print "\n";
}
if ( ( $x !~ /^\d\d\/\d\d\/\d\d/ )
&& ( $x != "Patient" ) )
{
if ( $x !~ /^((\d+)||(\d+,\d+))\.\d\d/ ) {
print "";
print $x;
print "\n";
}
}
}
if ( $x =~ m/^((\d+)||(\d+,\d+))\.\d\d/ ) {
print "";
print $x;
print "\n";
}
if ( $x =~ m/^((\$\d+)||(\$\d+,\d+))\.\d\d/ ) {
print "";
print $x;
print "\n";
}
}
}
if ( $x =~ m/^Patient/ ) {
last WID;
}
}
if ( $obj->has_members ) {
dump_members($obj);
}
}