My personal opionion would be that you could look at the implementation of
File::Spec as an example.
AnyDBM_File has a somewhat similar setup, trying to load one of a few virtually equivalent modules, depending on what kind of DBM_File is supported on your sytem.
As a second idea, you could try out using if, and let the condition depend on $^O.