I don't know if it is correct, but I tried to write a test for the 
DOS EOF removal in MARC::File::USMARC [1]. This is the first test 
file I've tried to write, so please let me know where I went wrong.

 From the dosEOFtest.t file description:

Checks t/dosEOF.usmarc, which contains one record,
which is just sample1.usmarc with \x1a added as a final character.

When writing tests, should one take into account the file 
systems, or is the test end-user expected to deal with this? For 
example, in order to use  dosEOFtest.t under MacPerl, I need to 
change:
my $record_file_name = '/t/dosEOF.usmarc';
to
my $record_file_name = ':t:dosEOF.usmarc';

 From the previous message:

>(BTW, when modifying existing code, use the same conventions,
>in this case "\x1a" rather than "\1A".)

Sorry about that. I wasn't sure if case mattered, so I used \x1A 
(which BBEdit Lite gave me when I copied in the raw character).

In MARC::File::USMARC, the constants:

use constant SUBFIELD_INDICATOR     => "\x1F";
use constant END_OF_FIELD           => "\x1E";
use constant END_OF_RECORD          => "\x1D";

have capital letters, while the garbage removal uses lowercase (as 
are 2 in comments in decode():
$usmarc =~ s/^[ \x00\x0a\x0d]+//;

my $dir = substr( $text, LEADER_LEN, $data_start - LEADER_LEN - 1 ); 
# -1 to allow for \x1e at end of directory

# character after the directory must be \x1e
(substr($text, $data_start-1, 1) eq END_OF_FIELD

#################################################

[1] http://home.inwave.com/eija/bryanmodules/ , file 
dosEOFtest.tar.gz or the directory dosEOFtest for uncompressed versions.

Thank you,
Bryan Baldus
Cataloger (Quality Books Inc.)
http://home.inwave.com/eija/

Reply via email to