Skip Menu |

This queue is for tickets about the Text-RecordParser CPAN distribution.

Report information
The Basics
Id: 4665
Status: resolved
Worked: 26 min
Priority: 0/
Queue: Text-RecordParser

People
Owner: kclark [...] cpan.org
Requestors: o.weinert [...] ancientsound.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Text::RecordParser accepts no Pipe-Char as field-separator
Hi Ken, today i'd tested your Text::RecordParser packet and found it very useful. But it seems that it is not able to split fields at a pipe-char (ASCII 124, Hex 0x7C). All i get, when i try to split a record is: ------------------------------------------------------------------------ Error reading line 'MSH|^~\&|BOSS|01|PC|00|20020715121500||ADT^A02|BOSS20020715815758|P|2.2' at ./hl7parser.pl line 24 ------------------------------------------------------------------------ The record-separator is a \n (and so it is in the file too), so the Error must point on the field-separator: | When i translate all | in , or ; (and do this i my code too) everything works fine. I think this is not really a bug, but more a 'nice to have' :-) May be in the next Version ? best whishes from rainy Germany: Olaf Weinert
Olaf, I've just written a test to try your bug, and I have no problem splitting the line you gave on the pipe ("|"). Can you please provide me the snippet of code where you're using Text::RecordParser? Perhaps I'm missing something in the interface. Here's what I did: my $p = Text::RecordParser->new( data => 'MSH|^~\&|BOSS|01|PC|00|20020715121500||ADT^A02|BOSS20020715815758|P|2.2', field_separator => '|', record_separator => "\n", ); my $row = $p->fetchrow_array; use Data::Dumper; print "row = ", Dumper($row), "\n"; Here's what I see: row = $VAR1 = [ 'MSH', '^~\\&', 'BOSS', '01', 'PC', '00', '20020715121500', '', 'ADT^A02', 'BOSS20020715815758', 'P', '2.2' ]; That looks right to me. ky
[o.weinert@ancientsound.de - Sun Dec 14 07:03:57 2003]: Show quoted text
> Am Samstag, 13. Dezember 2003 22:14 schrieb via RT: > > Yeah, that looks ok for me too. Here's my code snippet: > ------------------------------------------------------------------- > #!/usr/bin/perl -w > use strict; > use warnings; > use Text::RecordParser; > my ( > $pars, $file, @fields, > ); > > $pars=Text::RecordParser->new( > record_separator => "\n", > field_separator => '|'); > $pars->filename('2053549.a02'); > @fields = $pars->fetchrow_array; > foreach (@fields) { > print $_, "\n"; > } > ------------------------------------------------------------------- > I'm not able to find the error in here (i'm error-blind for shure ;-) > Thanks,
Olaf, Can you please e-mail me the file you're parsing? Perhaps I can see the error better if I have it. Danke, ky
[o.weinert@ancientsound.de - Tue Dec 16 14:14:35 2003]: Show quoted text
> > Can you please e-mail me the file you're parsing? Perhaps I can see the > > error better if I have it.
> Here it comes:
Olaf, I'm now able to see the message you've reported. I've made a modification that seems to fix the problem, and I've committed your file as test data and written a test to make sure this stays fixed. Please try the attached release candidate for 0.05. ky
Download Text-RecordParser-0.05.tar.gz
application/x-gzip 11.6k

Message body not shown because it is not plain text.

[KCLARK - Tue Dec 16 15:48:29 2003]: Olaf, I'm assuming that 0.05 will fix your problems, so I've released it on CPAN. Please let me know if you continue to have problems. ky