ruby-marc/ruby-marc — Issue #6: undefined method `pack' for nil:NilClass (NoMethodError)
Author: psla
Created: 2011-12-23 22:41:19+00:00
State: open

For such marc.dat file:

```
00975nam a2200265 i 4500
008 080703s2008 pl a f f |001 0 pol
015 $a PB 18025/2008
020 $a 9788324611775
040 $a WA N $c WA N
041 1 $a pol $h eng
080 $a 004.42:004.438A/Z:004.434:004.774](07)
100 1 $a Martin, Robert C.
245 10 $a Agile : $b programowanie zwinne : zasady, wzorce i praktyki zwinnego wytwarzania oprogramowania w C# / $c Robert C. Martin, Micah Martin ; [tł. Mikołaj Szczepaniak].
246 1 $i Tyt. oryg.: $a Agile principles, patterns, and practices in C#, $f 2007.
260 $a Gliwice : $b Wydawnictwo Helion, $c cop. 2008.
300 $a 843 s. : $b il. ; $c 25 cm.
504 $a Bibliogr. przy niektórych rozdz. Indeks.
650 4 $a AJAX (informat.)
655 4 $a Podręczniki.
700 1 $a Martin, Micah.
700 1 $a Szczepaniak, Mikołaj. $e Tł.
998 $a ik
920 $a 978-83-246-1177-5 : $c zł 109
999 $a zuz $b 1pj
999 $a zk $b aks $c ezm $a RZ30jo $x 31 $y 08
```

and such code:

```
require 'marc'

# reading records from a batch file
reader = MARC::Reader.new('marc.dat')
for record in reader
# print out field 245 subfield a
puts record['245']['a']
end
```

Following exception is thrown:

```
[piotr@mirabilis rubytests]$ ruby marcreader.rb
/home/piotr/.rvm/gems/ruby-1.9.3-p0/gems/marc-0.4.3/lib/marc/reader.rb:119:in `block in decode': undefined method `pack' for nil:NilClass (NoMethodError)
from /home/piotr/.rvm/gems/ruby-1.9.3-p0/gems/marc-0.4.3/lib/marc/reader.rb:94:in `upto'
from /home/piotr/.rvm/gems/ruby-1.9.3-p0/gems/marc-0.4.3/lib/marc/reader.rb:94:in `decode'
from /home/piotr/.rvm/gems/ruby-1.9.3-p0/gems/marc-0.4.3/lib/marc/reader.rb:64:in `each'
from marcreader.rb:5:in `

'
```