Adding salt does two things:
1) It makes it harder to brute force the password list.
2) If person A knows his password hashes to the same value as person B's -- some websites stupidly publish users that had the same password hash -- person A could login as person B using their own password without even knowing person B's password. Adding salt would create different hashes (even for the same password), eliminating this problem.
usually based on some input from the user record or the password itself
Salts are usually random. Ideally, each user has a different salt. They must definitely NOT be based on the password since the salt must be known. Basing it on the password would leak info about the password.
Crypt::PasswdMD5 creates a salt for you if you don't specify one, according to the documentation.