Sorry for picking this up so late but this feels clumsy to me, can't you just say:

if ($package_repo_url != undef or $package_repo_name != undef) <- if x is not set or y is not set { you must set both }.  Unless I'm spacing out due to the afternoon you just need to know if either are unset.