Skip Menu |

This queue is for tickets about the MARC-Record CPAN distribution.

Report information
The Basics
Id: 1826
Status: resolved
Priority: 0/
Queue: MARC-Record

People
Owner: Nobody in particular
Requestors: Jenda [...] Krynicky.cz
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.13
Fixed in: (no value)



Subject: Warnings, handling malformed data
When I try to make the module on my computer (Win2K, ActivePerl 5.6.1 build 631) and do "make test" I get a whole log of warnings from the "t\75.warnings" test and it fails all tests: t\75.warnings.......Use of uninitialized value in integer eq (==) at C:/temp/MAR C-Record-1.13/blib/lib/MARC/File/USMARC.pm line 116. Use of uninitialized value in concatenation (.) or string at C:/temp/MARC-Record -1.13/blib/lib/MARC/File/USMARC.pm line 116. substr outside of string at C:/temp/MARC-Record-1.13/blib/lib/MARC/File/USMARC.p m line 120. Use of uninitialized value in split at C:/temp/MARC-Record-1.13/blib/lib/MARC/Fi le/USMARC.pm line 120. Use of uninitialized value in length at C:/temp/MARC-Record-1.13/blib/lib/MARC/F ile/USMARC.pm line 123. Use of uninitialized value in length at C:/temp/MARC-Record-1.13/blib/lib/MARC/F ile/USMARC.pm line 125. Use of uninitialized value in string eq at C:/temp/MARC-Record-1.13/blib/lib/MAR C/File/USMARC.pm line 129. Use of uninitialized value in unpack at C:/temp/MARC-Record-1.13/blib/lib/MARC/F ile/USMARC.pm line 134. Use of uninitialized value in integer eq (==) at C:/temp/MARC-Record-1.13/blib/l ib/MARC/File/USMARC.pm line 116. Use of uninitialized value in concatenation (.) or string at C:/temp/MARC-Record -1.13/blib/lib/MARC/File/USMARC.pm line 116. substr outside of string at C:/temp/MARC-Record-1.13/blib/lib/MARC/File/USMARC.p m line 120. Use of uninitialized value in split at C:/temp/MARC-Record-1.13/blib/lib/MARC/Fi le/USMARC.pm line 120. Use of uninitialized value in length at C:/temp/MARC-Record-1.13/blib/lib/MARC/F ile/USMARC.pm line 123. Use of uninitialized value in length at C:/temp/MARC-Record-1.13/blib/lib/MARC/F ile/USMARC.pm line 125. Use of uninitialized value in string eq at C:/temp/MARC-Record-1.13/blib/lib/MAR C/File/USMARC.pm line 129. Use of uninitialized value in unpack at C:/temp/MARC-Record-1.13/blib/lib/MARC/F ile/USMARC.pm line 134. Use of uninitialized value in integer eq (==) at C:/temp/MARC-Record-1.13/blib/l ib/MARC/File/USMARC.pm line 116. Use of uninitialized value in concatenation (.) or string at C:/temp/MARC-Record -1.13/blib/lib/MARC/File/USMARC.pm line 116. substr outside of string at C:/temp/MARC-Record-1.13/blib/lib/MARC/File/USMARC.p m line 120. Use of uninitialized value in split at C:/temp/MARC-Record-1.13/blib/lib/MARC/Fi le/USMARC.pm line 120. Use of uninitialized value in length at C:/temp/MARC-Record-1.13/blib/lib/MARC/F ile/USMARC.pm line 123. Use of uninitialized value in length at C:/temp/MARC-Record-1.13/blib/lib/MARC/F ile/USMARC.pm line 125. Use of uninitialized value in string eq at C:/temp/MARC-Record-1.13/blib/lib/MAR C/File/USMARC.pm line 129. Use of uninitialized value in unpack at C:/temp/MARC-Record-1.13/blib/lib/MARC/F ile/USMARC.pm line 134. t\75.warnings.......FAILED tests 1-5 Failed 5/5 tests, 0.00% okay You seem to want to test the module's behaviour when passed malformed data, but the handling is incorrect. Eg. on line 112 in MARC::File::USMARC you try to match the data to a regexp. If it fails you print a warning, but continue as if it matched. I think the code should be something like: # Check for an all-numeric record length ($text =~ /^(\d{5})/) or return $marc->_warn( "Record length \"", substr( $text, 0, 5 ), "\" is not numeric $location" ); So that you warn about the problem and do not try to process the data further. Jenda