On Wed, Mar 25, 2009 at 11:25:15AM -0400, Jonathan Yu wrote:
> This sounds like a great idea. However, I would recommend that when
> you do write your module, you include some way of determining which
> version is currently in use.
> 
> For example, it's difficult to detect which version of File::Spec is
> in use, because it's set up so that it does @ISA =
> ('File::Spec::Unix'); Other classes, including the Win32 one, subclass
> the Unix class to get its basic functionality too, so doing:
> File::Spec->isa('File::Spec::Unix') doesn't work properly.
 
Noted.

> For reasons related to module naming, I wouldn't simply do:
> File::Spec::$^O. Consider the case where Linux and OS/2 both use the
> same class, Unix (as happens with File::Spec). Then simply appending
> $^O will mean you need to copy the class for both 'linux' and 'OS2'.
> 
> File::Spec handles it internally by using a hash mapping to the
> different modules where appropriate. But this might not work in
> general (as your class is designed for), since the behaviours of
> different operating systems are different. File::Spec does it because
> filehandling on OS2 and Linux are similar, but other behaviours may be
> different.

Yes; some sort of (heirarchial?) mapping of $^O down to some more
generic name, in the way File::Spec and Devel::CheckOS do.

Further thoughts - we don't necessarily have to stop here. Having
determined it's Linux, what kind? Perhaps on a 2.6 kernel we'll be
different to 2.4? Or Debian? Would this logic ever become useful?

> But, getting to what your module should be named, no good ideas really
> come to mind. But if you're going to leave out the Magic class names
> (personally I don't see anything wrong with it, and think
> Class::OSMagic might be appropriate)... Then my next choice would be
> Class::ForSystem, since it's not too long and conveys what the module
> is designed to do.

There are thoughts gathering around something like

  Class::ForOS
  Class::ForSystem
  Class::ByOS
  Class::PerOS

Though maybe something on "System" rather than just "OS"... Anyone have
any thoughts on the distinction?

-- 
Paul "LeoNerd" Evans

leon...@leonerd.org.uk     |    CPAN ID: PEVANS

Attachment: signature.asc
Description: Digital signature

Reply via email to