Custom pam module

Does anyone know how to create a custom pam module for modifying the login authentication procedure?

I just found a helpful sun doc on this.