A little investigation yielded the answer.  It was a matter of
changing rb_define_class to rb_define_class_under.  I'll post a patch soon.

Samuel Tesla <samuel / alieniloquent.com> writes:

> I patched ruby-pam so that it wouldn't give me warnings about the
> allocate function, and back on 1.8.0_pre3, it was running smoothly.
> But on 1.8.0_pre4 and beyond, it's giving me this error:
> 
> warning: toplevel constant PAMError referenced by PAM::PAMError
> 
> I saw a similar issue with YAML back in July on the list:
> 
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/74315
> 
> Does anybody have an idea as to what might be going on here?